Duolith docs

Button

The main pressable control: a label, an optional icon, in four variants and three sizes.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringThe text on the button, and its accessible name.
variant"primary" | "secondary" | "ghost" | "danger"primaryHow much the button stands out; danger for destructive actions.
size"sm" | "md" | "lg"mdHeight 32, 44 or 52 pixels.
iconstringAn icon from the built-in set, before the label.
iconEndstringAn icon after the label, such as arrow-right.
loadingbooleanfalseShows a spinner in place of the icon and stops presses.
disabledbooleanfalseCannot be pressed or focused; drawn at 45% opacity.
fullbooleanfalseTakes the full width of its container.
submitbooleanfalsePressing it sends the form it is in.
onPress() => voidRuns when the button is pressed.

Children

Extra content after the label.

States

StateLooks like
pressedScales to 97% and darkens its background.
focusedA 2px primary outline, 2px away.
disabled45% opacity; no presses, no focus.
loadingA small spinner replaces the icon; disabled while it shows.

Accessibility

rolebutton
nameThe label text (or the children).
focusTab reaches it; Shift+Tab leaves it. A disabled one is skipped.
keyboardEnter and Space press it.

Theme tokens

color.primary color.on-primary color.raised color.border color.ink color.danger space.3 space.4 space.6 radius.md radius.sm text.label text.caption

Example

<Button label="Save" icon="check" loading={saving} onPress={save} />