IconButton
<IconButton>TailwindCSS ModulesSquare icon-only buttons used for compact actions like closing dialogs, editing entries, or toggling state. Includes a built-in accessible tooltip to guarantee aria-compliance when visual text is omitted.
npx coloxo add icon-button --style coloxo-cssimport { IconButton } from '@coloxo/ui';Design Tokens:
1. Variant Matrix
Every variant rendered in default, disabled, and destructive states at medium height (40px).
| Variant | Default | Disabled | Tooltip |
|---|---|---|---|
| primary | |||
| secondary | |||
| secondary-brand | |||
| tertiary | |||
| primary-destructive | |||
| secondary-destructive | |||
| tertiary-destructive |
2. Control heights (Sizes)
IconButton guarantees perfectly square aspect ratios across all 5 enterprise control heights.
Sizes
size="xs"Compact headers, inner table rows
size="sm"Secondary dialogs, data toolbars
size="md"DEFAULTStandard forms, dialog footers
size="lg"Marketing / checkout actions
size="xl"Hero CTAs, mobile touch targets
3. Interactive Props Configurator
Disabled
Tooltip
<IconButton aria-label="Settings"> <Settings /></IconButton>4. Dark theme
IconButtons automatically reverse contrast variables for dark surfaces.
TertiarySecondaryPrimaryDestructive5. Enterprise layout compositions
Demonstrating typical dense interfaces that require icon-only actions.
Accessibility
Because IconButtons lack visible text, aria-label is strictly typed as a required prop.
Providing the tooltip prop adds an accessible visual label on hover/focus, helping sighted users.
All variants meet WCAG 2.1 AA focus indication with consistent 2px rings and offsets.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| aria-label | string | — | Required accessible name. |
| variant | "primary" | "secondary" | "secondary-brand" | "tertiary" | "primary-destructive" | "secondary-destructive" | "tertiary-destructive" | tertiary | Visual style. |
| size | "xs" | "sm" | "md" | "lg" | "xl" | md | Square control size. |
| tooltip | string | — | Optional visible tooltip. |