import { Icon, Text } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
export default function Example() {
return (
<Stack direction="horizontal" space="space-300">
<Stack direction="horizontal" space="space-075">
<Icon name="truck" />
<Text>Shipped</Text>
</Stack>
<Stack direction="horizontal" space="space-075">
<Icon name="calendar" />
<Text>Due April 17</Text>
</Stack>
<Stack direction="horizontal" space="space-075">
<Icon name="user" />
<Text>Ada Lovelace</Text>
</Stack>
</Stack>
);
}import { Icon } from "@senvenli/react/display";Examples
Sizes
Small at 12px, default at 16px and large at 20px.import { Icon } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
export default function Example() {
return (
<Stack direction="horizontal" space="space-200">
<Icon name="package" size="small" />
<Icon name="package" />
<Icon name="package" size="large" />
</Stack>
);
}Semantic colors
Only when the icon carries that meaning, and always with the word.import { Icon, Text } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
export default function Example() {
return (
<Stack direction="horizontal" space="space-300">
<Stack direction="horizontal" space="space-075">
<Icon name="circle-check" color="success" />
<Text>Payment received</Text>
</Stack>
<Stack direction="horizontal" space="space-075">
<Icon name="triangle-alert" color="warning" />
<Text>Payment pending</Text>
</Stack>
<Stack direction="horizontal" space="space-075">
<Icon name="circle-x" color="danger" />
<Text>Payment failed</Text>
</Stack>
<Stack direction="horizontal" space="space-075">
<Icon name="info" color="information" />
<Text>Refund requested</Text>
</Stack>
</Stack>
);
}Standing alone
Without text beside it, `label` gives the icon its accessible name.import { Icon, Text } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
export default function Example() {
return (
<Stack direction="horizontal" space="space-075">
<Text>Project Atlas</Text>
<Icon name="lock" color="subtle" label="Private project" />
</Stack>
);
}Guidelines
When to use it
- A symbol helps people scan or recognize an action, status or object.
- An icon-only control needs a picture; give it a label.
Use something else when
- The status needs a word, not only a symbol. Badge
Do and avoid
- Pair icons with text unless the meaning is universal; give a standalone icon a label.
- Use the semantic colors (danger, success…) only when the icon carries that meaning.
Accessibility
Built in
- Decorative (hidden from assistive technology) when it has no label.
- Exposed as an image named by
labelwhen it has one. - Directional icons mirror on right-to-left pages.
You provide
- A
labelwhen the icon carries meaning on its own.
API reference
Icon
| Prop | Type | Default | Description |
|---|---|---|---|
nameRequired | IconName | – | Any Lucide name, kebab-case ("house", "search", "calendar-range"). |
size | IconSize | – |
|
color | IconColor | – |
|
label | string | – | The accessible name for an icon that carries meaning on its own. Without it the icon is decorative and hidden from assistive technology, which is right when text next to it already says the same thing. |
isDirectional | boolean | – | Mirrors the icon on an RTL page. Left out, the names in |
nameRequiredIconNameAny Lucide name, kebab-case ("house", "search", "calendar-range").
sizeIconSizesmall12px,default16px,large20px (ds-size-icon-*).colorIconColorinherit(default) takes the text colour around it; the others are theds-icon-*tokens.labelstringThe accessible name for an icon that carries meaning on its own. Without it the icon is decorative and hidden from assistive technology, which is right when text next to it already says the same thing.
isDirectionalbooleanMirrors the icon on an RTL page. Left out, the names in
DIRECTIONAL_ICONS(arrows and chevrons that point along the reading direction, undo/redo, send, sign in/out) mirror and every other icon stays as drawn.truemirrors any icon;falsekeeps a directional one as drawn (a compass arrow, a "swipe left" hint).