Metric
Present a labelled value, trend, and supporting context as a compact metric.
Default
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let defaultMetric =
fveMetric {
_label "Total items"
"1,280"
}On this page
Installation
Copy this component and its required dependencies into the consumer-owned Components project.
dotnet fve add metric --config src/Acme.Components/fve.jsonNo additional JavaScript import is required.
The CLI resolves dependencies and preserves consumer-authored files. See Installation for project initialization, Tailwind, the shared runtime, and building/loading your app entry.
Usage
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let defaultMetric =
fveMetric {
_label "Total items"
"1,280"
}With trend and status
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let totalItemsMetric =
fveMetric {
_label "Total items"
_trend "Up 8% from last month"
_description "Across all projects"
"1,280"
fveMetricStatus {
fveBadge {
_color Color.Success
"Current"
}
}
}With review status
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let pendingItemsMetric =
fveMetric {
_label "Pending items"
_description "Require review before publishing"
"14"
fveMetricStatus {
fveBadge {
_color Color.Warning
"Needs review"
}
}
}Multiple metrics
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let multipleMetrics =
div {
_role "group"
_ariaLabel "Monthly activity metrics"
_class
"grid w-full min-w-0 max-w-4xl grid-cols-[repeat(auto-fit,minmax(min(100%,12rem),1fr))] justify-items-center gap-8"
for label, value in [ "Views", "48,000"; "Downloads", "3,120"; "Items", "1,280" ] do
fveMetric {
_label label
_description "September 2026"
value
}
}API reference
module MetricDsl =
val fveMetric : ComponentElementBuilder
val fveMetricStatus : ComponentElementBuilder