IconButton
import { IconButton } from "@study/ui"
For toolbars, the ⋯ of a card, close crosses. The label is required: it is the name for screen readers and appears as a tooltip.
Result
Loading...
Live Editor
function Example() { const [pinned, setPinned] = useState(false); return ( <div style={{ display: "flex", gap: 8 }}> <IconButton icon="more" label="More actions" /> <IconButton icon="star" label="Pin" pressed={pinned} onClick={() => setPinned(!pinned)} /> <IconButton icon="close" label="Close" variant="secondary" /> </div> ); }
Variants and states
Light
Dark
When to use
✓ DoWell-known signs where there is little room: ⋯, ×, pencil.
✗ Don'tAn important action only as an icon – better a Button with text.
- Never delete with a single IconButton without asking – better in the menu behind ⋯ with a ConfirmDialog.
pressedfor toggles like "pin"; the state is then read out.badgeshows a small number, such as unread notifications; at 0 it disappears. Screen readers hear it with the name ("Notifications (3)").
Props
| Prop | Type | Default | Meaning |
|---|---|---|---|
icon * | enum | – | |
label * | string | – | What it does, for screen readers and as a tooltip. Required: the icon alone says nothing to them. |
badge | number | – | A small count on the button, e.g. unread notifications; hidden at 0. It is added to the label for screen readers. |
pressed | boolean | – | For toggles: whether it is on. |
ref | Ref<HTMLButtonElement> | – | |
size | ButtonSize | md | |
tone | "blau" | "petrol" | "gruen" | "gelb" | "orange" | "rot" | "violett" | "grau" | – | |
variant | "primary" | "secondary" | "soft" | "ghost" | ghost |
Accessibility
labelbecomesaria-labelandtitle; the icon itself is hidden.pressedsetsaria-pressed.- 36 px even in
sm;mdmeets 44 px.