IconButton
A 44px circular button for a single icon, with a required accessible name.
Example
import { IconButton } from "@porcelana/ui";
import { PlusIcon, BellIcon, MoreIcon } from "@porcelana/icons";
export default function Example() {
return (
<div style={{ display: "flex", gap: 12 }}>
<IconButton aria-label="Add alarm" variant="primary">
<PlusIcon size={20} />
</IconButton>
<IconButton aria-label="Notifications">
<BellIcon size={20} />
</IconButton>
<IconButton aria-label="More options" variant="ghost">
<MoreIcon size={20} strokeWidth={3} />
</IconButton>
</div>
);
}Import
import { IconButton } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app rootProps
Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.
IconButton
A 44px circular button for a single icon. Always 44px or larger for touch.
| Prop | Type | Default | Description |
|---|---|---|---|
aria-labelrequired | string | – | Required: icon-only buttons need an accessible name. |
disabled | boolean | – | Prevents interaction and dims the control. |
id | string | – | Element id. Generated automatically when omitted. |
size | "md" | "lg" | null | – | Size. Every size keeps at least a 44px touch target. |
type | "button" | "submit" | "reset" | – | Button type (defaults to "button"). |
variant | "primary" | "soft" | "ghost" | null | – | Visual style. |
Accessibility
- aria-label is required by the type: an icon-only button without a name fails to compile.
- Icons inside are decorative (aria-hidden) by default.
Mobile
- Always at least 44 × 44px; the lg size is 52px.