IconButton
A button that shows only an icon, for actions people repeat so often that the picture is enough. It always has a name: it appears on hover and on focus, and it is what a screen reader says.
import { IconButton } from '@sypnia/ui/react'
Actions on a thing
Each icon names itself on hover and on focus. The destructive one is red and comes last.
Code
import { IconButton } from '@sypnia/ui/react';
// Rest the pointer on one, or reach it with Tab: its name appears.
export default function RowActions() {
return (
<div className="sy-row">
<IconButton icon="edit" label="Rename table" />
<IconButton icon="copy" label="Copy table ID" />
<IconButton icon="download" label="Export as CSV" />
<IconButton icon="trash" label="Delete table" variant="danger-quiet" />
</div>
);
} Sizes and variants
The same three sizes and variants as Button. Quiet is the default.
Code
import { IconButton } from '@sypnia/ui/react';
export default function SizesAndVariants() {
return (
<div className="sy-row">
<IconButton size="sm" icon="filter" label="Filter rows" />
<IconButton icon="filter" label="Filter rows" />
<IconButton size="lg" icon="filter" label="Filter rows" />
<IconButton variant="secondary" icon="plus" label="Add column" />
<IconButton variant="primary" icon="plus" label="New row" />
</div>
);
} States
A toggle that stays pressed, a busy one (press it) and a disabled one.
Code
import { useState } from 'react';
import { IconButton } from '@sypnia/ui/react';
export default function States() {
const [starred, setStarred] = useState(false);
const [busy, setBusy] = useState(false);
const refresh = () => { setBusy(true); setTimeout(() => setBusy(false), 2000); };
return (
<div className="sy-row">
<IconButton icon="star" label={starred ? 'Remove from favourites' : 'Add to favourites'} aria-pressed={starred}
variant={starred ? 'secondary' : 'quiet'} onClick={() => setStarred((s) => !s)} />
<IconButton variant="secondary" icon="download" label={busy ? 'Exporting…' : 'Export as CSV'} busy={busy} onClick={refresh} />
<IconButton icon="trash" label="Delete table" disabled />
</div>
);
} When to use it
Use it when
- Space is tight and the action is familiar: edit, copy, delete, close, filter.
- The same action repeats on every row of a table or a list.
- It toggles something on and off: pass
aria-pressedand change the label to say what a press will do.
Do not use it when
- It is the main action of the surface: use a Button with words.
- The icon would need explaining. If people have to guess, write the label.
- The action destroys something and stands alone: «Delete project» in words is safer than a bin.
For everyone
labelis required: it is the accessible name and the tooltip. The tooltip appears on hover and on keyboard focus, and Escape hides it.- Enter and Space press it. On touch screens it is never smaller than 44 px.
- A toggle announces «pressed» or «not pressed» through
aria-pressed. - Set
tooltip={false}only when the same words are already visible right beside it.
Props
| IconButton | Type | Default |
|---|---|---|
iconrequired | "function" | "error" | "replay" | "performance" | "uptime" | "traces" | "rage-click" | "dead-click" | "alert" | "summary" | "watch" | "sleep" | "light" | "suggestion" | "prompt" | "mcp" | "pull-request" | "git-branch" | "fix" | "check" | "open-source" | "self-host" | "sdk" | "engine" | "signals-in" | "web" | "mobile" | "backend" | "cloud" | "data" | "user" | "clock" | "shield" | "lock" | "mail" | "star" | "copy" | "arrow-right" | "arrow-up-right" | "chevron-down" | "plus" | "close" | "play" | "pause" | "search" | "info" | "warning" | "trash" | "menu" | "download" | "upload" | "filter" | "home" | "table" | "key" | "users" | "sun" | "moon" | "globe" | "sign-out" | "link" | "edit" | "calendar" | "chevron-left" | "chevron-right" | "chevron-up" | "minus" | "more" | "sort" | "arrow-left" | "arrow-up" | "arrow-down" | "arrow-down-right" | "arrow-down-left" | "arrow-up-left" | "swap" | "swap-vertical" | "chevrons-up-down" | "chevrons-left" | "chevrons-right" | "chevrons-down" | "chevrons-up" | "enter" | "undo" | "redo" | "refresh" | "expand" | "collapse" | "fullscreen" | "fullscreen-exit" | "move" | "grip" | "more-vertical" | "trend-up" | "trend-down" | "log-in" | "external" | "slash" | "equal" | "check-small" | "close-small" | "success" | "failure" | "help" | "plus-circle" | "minus-circle" | "ban" | "pending" | "dot" | "dot-off" | "bolt" | "flag" | "pin" | "bookmark" | "heart" | "thumbs-up" | "thumbs-down" | "sparkle" | "target" | "idea" | "award" | "crown" | "bell" | "bell-off" | "bug" | "fire" | "leaf" | "file" | "file-text" | "file-code" | "file-plus" | "file-check" | "file-table" | "file-lock" | "files" | "folder" | "folder-open" | "folder-plus" | "archive" | "clipboard" | "clipboard-check" | "paperclip" | "image" | "save" | "cloud-upload" | "cloud-download" | "cloud-off" | "import" | "export" | "share" | "inbox" | "send" | "box" | "layers" | "tag" | "hash" | "at" | "qr-code" | "book" | "book-open" | "notebook" | "rows" | "columns" | "grid" | "list" | "list-ordered" | "list-checks" | "kanban" | "chart-line" | "chart-bar" | "chart-area" | "chart-parts" | "chart-scatter" | "gauge" | "funnel" | "heatmap" | "sparkline" | "percent" | "sum" | "variable" | "braces" | "brackets" | "null" | "primary-key" | "relation" | "index" | "query" | "backup" | "migrate" | "seed" | "csv" | "json" | "bold" | "italic" | "underline" | "strikethrough" | "heading" | "text" | "paragraph" | "quote" | "code" | "align-left" | "align-center" | "align-right" | "indent" | "outdent" | "unlink" | "scissors" | "eraser" | "highlight" | "duplicate" | "paste" | "wand" | "palette" | "brush" | "ruler" | "crop" | "user-plus" | "user-minus" | "user-check" | "user-x" | "user-circle" | "team" | "organization" | "id-card" | "contact" | "role" | "chat" | "chats" | "comment" | "phone" | "video" | "mic" | "mic-off" | "megaphone" | "rss" | "mail-open" | "handshake" | "wave" | "desktop" | "laptop" | "tablet" | "terminal" | "window" | "browser" | "server" | "cpu" | "memory" | "disk" | "network" | "wifi" | "wifi-off" | "plug" | "power" | "container" | "queue" | "cron" | "webhook" | "api" | "route" | "load-balancer" | "dns" | "domain" | "certificate" | "firewall" | "rocket" | "deploy" | "rollback" | "logs" | "test" | "pipeline" | "commit" | "merge" | "fork" | "release" | "environment" | "region" | "robot" | "agent" | "puzzle" | "credit-card" | "wallet" | "receipt" | "invoice" | "cart" | "bag" | "coins" | "dollar" | "gift" | "plan" | "upgrade" | "usage" | "bank" | "history" | "timer" | "hourglass" | "calendar-check" | "calendar-plus" | "map" | "compass" | "translate" | "accessibility" | "keyboard" | "pointer" | "hand" | "print" | "support" | "stop" | "record" | "skip-forward" | "skip-back" | "fast-forward" | "rewind" | "volume" | "mute" | "camera" | "zoom-in" | "zoom-out" | "eye-off" | "sliders" | "settings" | "toggle" | "sidebar-left" | "sidebar-right" | "panel-bottom" | "split" | "layout" | "dashboard" | "cards" | "density" | "dark-mode" | "theme" | "mouse" | "cursor" | "select" | "picture-in-picture" | "scan" | "unlock" | "shield-off" | "shield-alert" | "shield-user" | "password" | "fingerprint" | "two-factor" | "policy" | "incognito" | "verified" | "audit" | "secret" | "p-telemetry" | "p-cases" | "p-agent" | "p-git" | "p-data" | "p-files" | "p-run" | "p-ai" | "p-mail" | "p-domains" | "p-design" | "p-learn" | "p-skills" | "p-app" | "p-ui" | |
labelrequiredWhat the button does. It is its accessible name and its tooltip: an icon alone is never enough. | string | |
busyThe action is running: the button stays focusable, does not fire again and shows a band of light. Change the label too («Saving…»). | boolean | |
className | string | |
disabled | boolean | |
hrefRenders a link that looks like a button. | string | |
onClick**Not recommended – use `onPress` instead.** `onClick` is an alias for `onPress` provided for compatibility with other libraries. `onPress` provides additional event details for non-mouse interactions. | (() => void) | |
size | "sm" | "md" | "lg" | |
target | string | |
tooltipSet false when the name is already visible right next to it. | boolean | true |
variantprimary: the one main action of a surface. secondary: the alternative. quiet: tertiary. danger: cannot be undone. | "primary" | "secondary" | "quiet" | "danger" | "danger-quiet" | quiet |