Skip to the page
Supply UI

Icon

A Lucide icon in the system's size, colour and line weight. Inside a button, menu item or nav item a bare lucide-react icon is styled the same way.

Preview

Use

The code of the preview above
import { Icon, Row } from '@/components/ui';
import { Heart, MapPin, Search, Star } from 'lucide-react';

<Row gap={4}>
  <Icon icon={Search} />
  <Icon icon={MapPin} label="Location" />
  <Icon icon={Star} solid label="Favourite" />
  <Icon icon={Heart} size="lg" />
  <Icon icon={Star} size="xl" />
</Row>

This page as text, for an AI

Options

OptionTypeWhat it does
icon NeededComponentTypeAn icon from lucide-react: import { Search } from 'lucide-react', then <Icon icon={Search} />.
label stringWhat the icon means, when it stands alone without text. Leave out when text sits next to it.
size "sm" | "md" | "lg" | "xl" · default 'md'md follows the text size; lg and xl are fixed sizes for empty states and tiles.
solid booleanFilled in: the "on" state of a star, a heart, a pin.

It also takes the 487 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.

Without React

With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:

components/icons.css

Helpers: states, do and don’t

A lucide-react icon in the theme's size and weight: <Icon icon={Search} />; give label when the icon alone says something.

Hooks and functions the components are made of, passed on so a project uses the same ones: keyboard shortcuts, options loaded while typing, search matching, saved preferences, screen-reader announcements, smooth sizes, the theme.

Do

  • Use useShortcut for app-wide keys, and show the key with formatShortcut so it reads right on each computer.
  • Use announce() to tell a screen reader what changed when nothing visible takes focus ("3 results").

Don't

  • Don't turn off the smooth sizes Toaster starts; boxes would jump when their content changes.