Icon
A Lucide glyph, inlined as SVG and drawn in currentColor.
import { Icon } from '@zitdevs/ui';Examples
Section titled “Examples”Write to us
5 min read
<span className="flex items-center gap-2"> <Icon name="mail" /> Write to us</span><Icon name="download" size={24} label="Download" className="text-primary" />The set
Section titled “The set”The design’s set, plus instagram and linkedin. IconName is a closed union of these names, so a
misspelt icon fails type-checking instead of rendering an empty box.
arrow-leftarrow-rightarrow-up-rightboxbracescalculatorcheckchevron-downchevron-leftchevron-rightcircle-alertcircle-checkclockcodecopydownloadexternal-linkeyefile-textfilterinfoinstagramlayout-templatelightbulblinklink2linkedinlist-checksmailmenupalettesearchservershare-2trending-uptriangle-alertwrenchx
To add one, add its inner SVG markup to iconPaths in packages/ui/src/components/atoms/icon-paths.ts
under its Lucide name, and add the name to tests/icon.test.tsx.
| Prop | Type | Default | Notes |
|---|---|---|---|
name |
IconName |
required | One of the set above. |
size |
number |
16 |
px. The design uses 14, 16, 18 and 24. |
label |
string |
— | Only for an icon that stands alone: adds role="img" and aria-label. |
ref |
Ref<SVGSVGElement> |
— | The <svg>. |
className |
string |
— | Colour (text-primary) or placement. |
| anything else | <svg> attributes |
— | Except role and the ARIA naming attributes, which label decides. |
Accessibility
Section titled “Accessibility”- Without
labelthe icon isaria-hidden: beside a label it is noise to a screen reader. - With
labelit is an image with that name. Use it only when nothing else names what the icon does.
Without JavaScript
Section titled “Without JavaScript”Inline SVG, no script, no request: it renders the same on the server and in the browser.
Theming
Section titled “Theming”None of its own: it takes the colour of its text. Set a role on it or on its parent, such as
text-primary.