Icon Button
A compact button that uses only an icon to represent its action.
- Status
- Not tracked
- Code
- In React
- Role
- Action
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { Heart, PencilSimple, ShareNetwork } from "@phosphor-icons/react";
import { IconButton, Tooltip } from "@/ui";
export default function IconButtonDemo() {
const [liked, setLiked] = useState<boolean>(false);
return (
<>
<Tooltip title="Edit">
<IconButton label="Edit" icon={<PencilSimple size={18} />} />
</Tooltip>
<Tooltip title="Share">
<IconButton label="Share" icon={<ShareNetwork size={18} />} />
</Tooltip>
<IconButton
label="Favorite"
aria-pressed={liked}
onClick={() => setLiked(!liked)}
icon={<Heart size={18} weight={liked ? "fill" : "regular"} />}
/>
</>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Pastes as editable layers. Shadows are not exported.
Props
- label
- string · default none
- Required. The accessible name, set as aria-label, because there is no visible text.
- icon
- ReactNode · default none
- Required. The icon. It is wrapped in aria-hidden.
- variant
- "primary" | "secondary" | "ghost" | "destructive" | "inverse" · default "ghost"
- The same colors as Button.
- size
- "md" | "lg" · default "md"
- 44 × 44 or 48 × 48, so both are full touch targets.
- shape
- "square" | "circle" · default "square"
- Square uses the button radius; circle is fully round.
- loading
- boolean · default false
- Shows a spinner in place of the icon, sets aria-busy and aria-disabled, and blocks clicks. Focus stays.
- disabled
- boolean · default false
- The native disabled attribute.
- ...rest
- ButtonHTMLAttributes · default none
- Every other button attribute, such as onClick or aria-pressed for a toggle.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🧰 Type
- variant
- Same values as Button.
- 📐 Size
- size
- md and lg.
- 🎯 State
- disabled, loading
- Hover, focus, and pressed come from the browser.
- ☘️ Icon
- icon
- Any Phosphor icon, 18 at md and 20 at lg.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- Tab reaches the button. Enter and Space press it.
- A disabled button is skipped. A loading one keeps focus and ignores presses.
Screen readers
- Announced as a button named by label. The icon is aria-hidden.
- Pass aria-pressed for a toggle, such as Favorite, so its on and off state is read.
What you still need to do
- Write a label that names the action, such as "Delete transaction", not the icon, such as "Trash".
- Wrap it in a Tooltip when the icon is not universally known, so sighted users get the name too.
- Keep the label the same for a toggle and use aria-pressed for the state.
- This component draws no focus indicator of its own. On this site a global :focus-visible rule draws a 2px outline in the border/focus role (--color-role-border-focus). Copy the role tokens and that rule, or an equivalent, into your app.
When to use
Toolbars and dense UI, where a label would take too much space.
Do and don't
Do
- Always pair with an accessible label / tooltip.
- Use recognizable, standard icons.
Don't
- Use for critical or destructive actions without confirmation.
- Use ambiguous or custom icons without a label.
Related
Other untracked components.
- Button GroupA set of related buttons, visually grouped together as a single control.Not tracked
- Code BlockShows read-only code with a copy button, in plain text that keeps 7:1 contrast in light and dark.Not tracked
- LinkNavigates the user to another page, section, or resource.Not tracked
- SelectLets users choose one option from a list in a dropdown.Not tracked
Status reflects the component tracker snapshot of 29 October 2026.