Stat
One number with its label and a note.
SourceStyles source@monoline/react 0.5.0Markdown for AI toolsstable
- Built on native elements
- A description list (dl) pairs the label with its value.
- Styles in one file:
19-avatar.css
Import
import '@monoline/css';
import {Stat} from '@monoline/react';
Not installed yet? Pick a route.
Copies the source and its styles into your project.
npx monoline add stat
Usage
import {Stat} from '@monoline/react';
<div style={{display: 'flex', gap: 'var(--s7)', flexWrap: 'wrap'}}>
<Stat label="Revenue" value="$12k" note="+4% this week" />
<Stat label="Users" value="1,204" note="all time" />
</div>
Examples
Row of stats
Props
StatProps
| Prop | Type | Default | Description |
|---|---|---|---|
label required | ReactNode | – | What the number measures, for example "Active users". |
value required | ReactNode | – | The metric itself, shown large. Include the unit or currency in the text. |
note | ReactNode | – | A short note: a change, a period, a unit. |
Data Attributes
State is exposed through attributes. Style it with these selectors, not with class toggles.
This component sets no state attributes.
CSS classes
| Class | Stylesheet |
|---|---|
.avatar | 19-avatar.css |
.avatar-group | 19-avatar.css |
.avatar-lg | 19-avatar.css |
.avatar-line | 19-avatar.css |
.avatar-sm | 19-avatar.css |
.stat | 19-avatar.css |
.stat-note | 19-avatar.css |
.stat-value | 19-avatar.css |
.tag | 19-avatar.css |
Customization
Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.
app.css
.avatar {
border-color: var(--accent);
}
Accessibility
- A description list (dl) pairs the label with its value.