IconButton
A round 44 button with only an icon.
$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/icon-button.jsonVariants and sizes
Disabled
Notification dot (motion)
When to use
- An action with a well-known icon and no room for text: close (×), notifications (bell), prev/next month, the ⋯ menu trigger.
- Top bar and rail controls (variant ghost).
When not to use
- The action needs a word to be understood → Button with an icon and a label.
- Going to another page → ListRow.
- The ⋯ trigger opens a list of actions → this IconButton + DropdownMenu.
Do and don't
Name every icon buttonaria-label says the action in Indonesian: "Tutup", "Notifikasi", "Bulan berikutnya". Screen readers read it; the tooltip is optional.
Invent icons for rare actions"Arsipkan" as a bare box icon is a guess for the user. Use a Button with a label, or put it in the ⋯ DropdownMenu.
Installation
Add IconButton with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.
API
import { IconButton } from "@/components/ui/icon-button"| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | – | Required. The action in words. |
icon | ReactNode | – | One Neat stroke icon, 20. |
variant | "secondary" | "ghost" | "secondary" | ghost only in the rail and top bar. |
size | "default" | "sm" | "default" | 44 / 36. sm keeps a 44 hit area. |
dot | boolean | false | Red notification dot, top right. |
disabled · onClick · render · className | Base UI Button props | – | render = asChild equivalent. |