Icons
Lucide, at the size of the text beside it, in the colour of that text. An icon alone always carries a name.
Draw icons from Lucide, let the component size them, and give
every icon-only control an aria-label. An icon is shorthand for a word; the word still has to be
there for the people and tools that cannot see the picture.
The Mail demo's toolbar over an open conversation, and its reply box. Archive, Delete and Mark as unread are icons alone, each named for a screen reader and shown its name in a tooltip on hover or focus: people use them all day, and Undo takes back a delete. Send keeps its word, because it is what the reply box is for. More actions needs no word anywhere, and the rarer actions behind it, Forward and Copy link, have theirs.
One set#
lucide-react is a peer dependency of @orz/ui, and every icon in the components comes from it.
Draw your own from the same set, imported by name with the Icon suffix (SearchIcon,
ChevronDownIcon), so a bundler keeps only those you use and every icon shares one stroke and one
grid. An icon from another set, even a better one, looks foreign beside the rest.
Size and colour#
| Where | Size |
|---|---|
In a Button, Badge or menu item | Nothing to set: the component sizes it, 16px in a default or lg Button, 14px in sm, 12px in xs |
Beside text-ui | size-4 (16px) |
Beside text-ui-sm | size-3.5 or size-3 |
| An empty state's or error's illustration | size-8 to size-10, text-muted-foreground |
Inbox
Touch sizes for the toolbar icons
Nothing in Starred
Star a conversation to find it here later.
Icons draw in currentColor, so they take the text colour around them. Set text-muted-foreground
on an icon that is decoration beside a label; leave it alone on an icon that is the control.
An icon drawn on a field, as a search box's glass is, is placed with top-sunken-centre and
-translate-y-1/2, not top-1/2: a field is a well, shaded under its top edge, and that puts the
middle of its lit part, and of the words in it, below the middle of its box. The utility follows
each style's well, so the icon lines up with the words in all of them.
In a Button, mark an icon before or after the label with data-icon="inline-start" or
"inline-end", and the button trims its padding on that side so the icon sits optically centred.
Each icon size draws its icon as large as the text size of its height does, icon-sm at
14px as sm does, so a toolbar command's icon
keeps its size when the bar hides the command's words.
Names#
- An icon-only control carries
aria-label, named for what it does ("Refresh", "Close"), never for what it shows ("Arrows"). - An icon beside a word is decoration and stays out of the accessibility tree. Lucide renders
aria-hidden="true"by itself unless you pass a label, so there is nothing to add. - An icon that carries meaning on its own, such as a status in a table cell, gets a visible word
next to it or an
aria-label, and never relies on colour alone.
Give an icon button its name with aria-label, and add a Tooltip on a pointer so a sighted
user can read it too.
Put the name only in a title or a tooltip. Neither shows on a touchscreen, and a screen
reader may never announce a tooltip that is not the control's label.
| The action | Show |
|---|---|
| Universally recognised (close, search, menu, more, back) | Icon alone, with aria-label |
| Frequent, in a toolbar people learn (bold, wrap, refresh, archive, a delete that Undo takes back) | Icon alone, with aria-label and a tooltip |
| The main action of a view, or anything destructive that cannot be undone | Icon and word, or the word alone |
| Rare, or with no established icon | The word alone |
Avatars#
An avatar is a person's icon, and follows the same rules. Put one beside the name where people scan
a column of who: a conversation's authors, the reviewers of a pull request, an assignee column, a
menu of people. The face is found before the word is read. There the name says who it is, so the
Avatar is aria-hidden, as the pull request and Tasks demos have it. The name alone is enough
where the person is one fact in a line of text ("alice committed 2 hours ago"), or where every row
is the same person. An avatar never stands in for the name: one shown alone, in a stack or a
narrow column, carries the name as its aria-label, and on a pointer a tooltip as well. The label
makes it an image of that name, whose initials and badge go unread, so a badge that means something,
such as a bot's mark, is said in the label too.
A mark that is not a person, a project or an organisation, takes shape="square". A SelectTrigger
and a QueryBox's value rows draw an avatar at their line's height on their own. Elsewhere, where
none of the three sizes fits the line it sits in, size the Avatar with a className and leave
out size, whose sm and lg outrank the class: its initials shrink to fit the box.
On each platform#
- Pointer. A tooltip names an icon button on hover and on keyboard focus.
- Touch. There is no hover, so no tooltip: an icon whose meaning is not obvious needs its word beside it on a phone, or moves into a menu where it has one. The button's hit area grows on a coarse pointer; the icon inside keeps its size.