Data Display
Badge, Tag and Status
Short labels that carry a state or a category.
import { Badge, CountBadge, Tag, Status } from 'faifo-design'Badge states a status with a tone. Tag labels a category the reader may have chosen.
CountBadge shows a number beside a label, and Status is the record-level state with its
indicator.
#When to use
- A tone carries meaning (
positive,warning,danger,info); never rely on colour alone, the label says the state. - Use
Tagfor classification,Badgefor state. - Announce a changing count only when the reader needs to hear it (
announce).
#Examples
Each example is a specimen of the package catalogue, rendered on the server exactly as shown in its code.
#Badge and tag
Tones carry meaning; badges fit their labels inside Inline and stretching Stack layouts.
Show codeHide code
import { Badge, CountBadge, Inline, Stack, Tag, Text } from 'faifo-design'
export const Example = () => (
<Inline
items={[
<Badge label="Neutral" />,
<Text tone="muted">No stock tracking</Text>,
<Badge label="Synchronized" tone="info" />,
<Badge label="Ready" tone="positive" />,
<Badge label="Needs review" tone="warning" />,
<Badge label="Failed" tone="danger" />,
<Tag label="Hà Nội" removeHref="#status" removeLabel="Remove Hà Nội filter" />,
<CountBadge count={12} label="12 pending items" />,
<Stack
items={[
<Badge label="Observation only" />,
<Text variant="bodySm" tone="muted">
The badge stays compact above its longer explanation.
</Text>,
<Badge
label="A longer status remains readable and wraps within a narrow container"
tone="info"
/>,
]}
/>,
]}
/>
)#API
Generated from the package source. A property without a description has none in the source yet.
#BadgeComponent
#CountBadgeComponent
| Property | Description | Type | Default |
|---|---|---|---|
countrequired | – | number | – |
labelrequired | – | string | – |
announce | – | boolean | – |
#TagComponent
| Property | Description | Type | Default |
|---|---|---|---|
labelrequired | – | string | – |
href | – | string | – |
removeHref | – | string | null | – |
removeLabel | – | string | null | – |
removeCommand | A native form command; form can target an external form. | { name: string; value: string; form?: string } | – |
disabled | – | boolean | – |
truncate | – | boolean | – |
#StatusComponent
| Property | Description | Type | Default |
|---|---|---|---|
labelrequired | – | string | – |
tone | – | Tone | – |
detail | – | string | – |
#Types
#Tone
type Tone = 'neutral' | 'info' | 'positive' | 'warning' | 'danger'#BadgeProps
The properties of Badge, listed above.
#TagProps
The properties of Tag, listed above.