defuss-shadcn / Data Display / statistic
Built with: CSS
StatisticATM
A numeric display for key metrics. Supports title, value, description, and trend indicators.
On this page (4)
§In Cards
Statistics composed inside card components for dashboard layouts - a card sized to its figure (width: fit-content, a min-width so a short value keeps its shape), not stretched across the page.
§CSS view file
Styles for the statistic component. Uses design tokens for colors, spacing, and radius.
@layer components { .statistic { display: flex; flex-direction: column; gap: 0.125rem; } .statistic-title { margin: 0; font-size: 0.8125rem; font-weight: 500; color: var(--muted-foreground); letter-spacing: 0.01em; } .statistic-value { margin: 0; font-size: 1.875rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; color: var(--foreground); } .statistic-description { margin: 0; font-size: 0.75rem; color: var(--muted-foreground); display: flex; align-items: center; gap: 0.25rem; } .statistic-trend { display: inline-flex; align-items: center; gap: 0.125rem; font-weight: 500; & svg { width: 0.75rem; height: 0.75rem; } &[data-trend="up"] { color: #16a34a; } &[data-trend="down"] { color: #dc2626; } }}Comments, ideas or improvements? Edit this page's source on GitHub