Skip to main content

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.
  • pressed for toggles like "pin"; the state is then read out.
  • badge shows a small number, such as unread notifications; at 0 it disappears. Screen readers hear it with the name ("Notifications (3)").

Props​

PropTypeDefaultMeaning
icon *enum–
label *string–What it does, for screen readers and as a tooltip. Required: the icon alone says nothing to them.
badgenumber–A small count on the button, e.g. unread notifications; hidden at 0. It is added to the label for screen readers.
pressedboolean–For toggles: whether it is on.
refRef<HTMLButtonElement>–
sizeButtonSizemd
tone"blau" | "petrol" | "gruen" | "gelb" | "orange" | "rot" | "violett" | "grau"–
variant"primary" | "secondary" | "soft" | "ghost"ghost

Accessibility​

  • label becomes aria-label and title; the icon itself is hidden.
  • pressed sets aria-pressed.
  • 36 px even in sm; md meets 44 px.