IconButton

A round 44 button with only an icon.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/icon-button.json

Variants and sizes

secondary (default, raised white) in content; ghost only in the rail and top bar. 44 default, 36 sm. dot = a red notification dot.

Disabled

40 % opacity (icon-only controls need a stronger cue than 60 %).

Notification dot (motion)

Send a new notification to see the dot come in. Press the bell or "Tandai sudah dibaca" to see it go out.

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

DoName every icon buttonaria-label says the action in Indonesian: "Tutup", "Notifikasi", "Bulan berikutnya". Screen readers read it; the tooltip is optional.
Don'tInvent 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.

terminal
bunx --bun shadcn@latest add https://mahrdesign.faizintifada.com/r/icon-button.json

API

import { IconButton } from "@/components/ui/icon-button"
PropTypeDefaultDescription
aria-labelstring–Required. The action in words.
iconReactNode–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.
dotbooleanfalseRed notification dot, top right.
disabled · onClick · render · classNameBase UI Button props–render = asChild equivalent.