Components
Icon
Token-sized Lucide icons with semantic colors, stroke control, and correct accessibility semantics.
Icon wraps a Lucide icon component and applies token-based sizing, semantic color, and stroke
width. It preserves the accessible name rules that controls need, so icons compose cleanly with
Button, IconButton, and future form and navigation components.
Live preview#
import { Icon, Stack, Text } from '@orkest/ui';
import { Circle } from 'lucide-react';
export function Example() {
return (
<Stack direction="row" align="center" gap={4}>
<Icon icon={Circle} size="xs" />
<Icon icon={Circle} size="sm" />
<Icon icon={Circle} size="md" />
<Icon icon={Circle} size="lg" />
<Icon icon={Circle} size="xl" />
<Text size="lg">
<Icon icon={Circle} size="inherit" />
</Text>
</Stack>
);
}Colors#
tone uses semantic theme tokens, so icons change with the active theme. The default is inherit,
which keeps icons aligned with the foreground of the surrounding control.
import { Icon, Stack } from '@orkest/ui';
import { Check } from 'lucide-react';
export function Example() {
return (
<Stack direction="row" align="center" gap={4}>
<Icon icon={Check} tone="default" />
<Icon icon={Check} tone="muted" />
<Icon icon={Check} tone="subtle" />
<Icon icon={Check} tone="accent" />
<Icon icon={Check} tone="success" />
<Icon icon={Check} tone="danger" />
</Stack>
);
}Stroke width#
The default stroke width comes from --ok-icon-stroke-width. Override it per icon when a denser or
lighter treatment is needed.
import { Icon, Stack } from '@orkest/ui';
import { Circle } from 'lucide-react';
export function Example() {
return (
<Stack direction="row" align="center" gap={4}>
<Icon icon={Circle} strokeWidth={1.25} />
<Icon icon={Circle} />
<Icon icon={Circle} strokeWidth={2.5} />
</Stack>
);
}Custom styles#
Native SVG attributes, className, style, and refs are forwarded. Inline styles can use semantic
tokens when a one-off color is needed.
import { Icon } from '@orkest/ui';
import { Circle } from 'lucide-react';
export function Example() {
return <Icon icon={Circle} size="xl" style={{ color: 'var(--ui-warning)' }} />;
}Composition#
Button and IconButton render Icon internally for their icon slots, so sizing and color inherit
from the control. The same rules make Icon ready for inputs and navigation items: use
size="inherit" to match text, and leave the icon decorative when the control already has a name.
import { Button, IconButton, Stack } from '@orkest/ui';
import { ArrowRight, Plus, Settings } from 'lucide-react';
export function Example() {
return (
<Stack direction="row" align="center" gap={2} wrap>
<Button leftIcon={Plus}>New project</Button>
<Button variant="secondary" rightIcon={ArrowRight}>
Continue
</Button>
<IconButton icon={Settings} label="Settings" variant="outline" />
</Stack>
);
}Props#
| Prop | Type | Default |
|---|---|---|
icon | LucideIcon | — |
| Required. A Lucide icon component, such as the Check import above. | ||
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'inherit' | 'md' |
| Maps to icon size tokens: 12px, 16px, 20px, 24px, or 32px. inherit uses 1em so the icon matches surrounding text. | ||
tone | 'default' | 'muted' | 'subtle' | 'inherit' | 'accent' | 'success' | 'danger' | 'inherit' |
| Semantic icon color. inherit follows the surrounding control foreground. | ||
label | string | — |
| Accessible name. When omitted, the icon is hidden from assistive technology. | ||
strokeWidth | number | 1.75 |
| Overrides the default icon stroke width token. | ||
className / style | string / CSSProperties | — |
| Merged with the internal class and inline style, including the stroke override. | ||
native SVG attributes | ComponentPropsWithoutRef<'svg'> | — |
| Forwarded to the SVG element; refs are forwarded to the underlying SVG. | ||
Accessibility#
Icons are decorative by default: they receive aria-hidden="true" and focusable="false".
Provide a label only when the icon conveys meaning on its own:
<Icon icon={Check} label="Completed" />When the icon sits inside a control that already has an accessible name, leave the icon decorative:
<button type="button" aria-label="Close dialog">
<Icon icon={X} size="sm" />
</button>Do not use an icon label to duplicate visible text in the same control. Use the icon as decoration when the surrounding text already communicates the action. Tone is not a substitute for meaning: pair success or danger icons with text or another non-color cue.
Related#
- Button for buttons with leading, trailing, or icon-only content.
- IconButton for icon-only actions with a required label.
- Text for adjacent labels.
- Stack for icon and text alignment.