Duolith docs

IconButton

A round button that shows only an icon; its label is for assistive technology.

Stability: experimental

Props

PropTypeDefaultMeans
iconstringThe icon to show.
labelstringThe accessible name, such as Search.
variant"primary" | "secondary" | "ghost" | "danger"ghostIts look.
size"sm" | "md" | "lg"md32, 44 or 56 pixels square.
disabledbooleanfalseCannot be pressed or focused.
selectedbooleanFor a button that stays on, such as Like: tinted primary and announced as pressed.
onPress() => voidRuns when pressed.

States

StateLooks like
pressedScales to 92%.
focusedA 2px primary outline.
disabled45% opacity.
selectedThe icon turns primary; aria-pressed is true.

Accessibility

rolebutton
nameThe label prop.
focusTab reaches it; Shift+Tab leaves it. A disabled one is skipped.
keyboardEnter and Space press it.
notesWith selected it is a toggle button (aria-pressed true or false).

Theme tokens

color.primary color.on-primary color.raised color.border color.ink color.danger radius.full

Example

<IconButton icon="heart" label="Like" selected={liked} onPress={toggleLike} />