Actions
IconButton
A square button that shows only an icon. Its label is required by the types, so it always has an accessible name; wrap it in a Tooltip to show the label visually.
import { IconButton, CloseButton } from '@reactloom/ui';Examples
Variants
The label doubles as a native tooltip unless you pass title.
import { CloseButton, HStack, IconButton } from '@reactloom/ui';
import { Bell, Pencil, Settings, Trash2 } from 'lucide-react';
export default function Example() {
return (
<HStack>
<IconButton icon={<Pencil />} label="Edit" variant="secondary" />
<IconButton icon={<Settings />} label="Settings" />
<IconButton icon={<Bell />} label="Notifications" variant="tertiary" />
<IconButton icon={<Trash2 />} label="Delete" variant="destructive" />
<CloseButton />
</HStack>
);
}Sizes
import { HStack, IconButton } from '@reactloom/ui';
import { Plus } from 'lucide-react';
export default function Example() {
return (
<HStack>
<IconButton size="sm" icon={<Plus />} label="Add (small)" variant="primary" />
<IconButton size="md" icon={<Plus />} label="Add (medium)" variant="primary" />
<IconButton size="lg" icon={<Plus />} label="Add (large)" variant="primary" />
</HStack>
);
}API reference
IconButton props
| Prop | Type | Default |
|---|---|---|
iconrequiredThe glyph. Decorative. | ReactNode | — |
labelrequiredAccessible name. Wrap in Tooltip to show it visually. | string | — |
variantSame variants as Button. | ButtonVariant | 'ghost' |
sizeSquare size. | 'sm' | 'md' | 'lg' | 'md' |
loadingLoading state; keeps its name. | boolean | false |
CloseButton props
| Prop | Type | Default |
|---|---|---|
labelTranslate for your locale. | string | 'Close' |
size | 'sm' | 'md' | 'lg' | 'sm' |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
IconButton
Renders Button, so its hooks apply too.
CSS variables
| Variable | Default |
|---|---|
--pl-button-radius | var(--pl-radius-md |
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-disabled] | present when on |
[data-full-width] | present when on |
[data-loading] | present when on |
[data-radius] | none · sm · md · lg · full |
[data-size] | sm · md · lg |
[data-variant] | primary · secondary · tertiary · outline · ghost · destructive · link |
Theme tokens it reads
--pl-color-accent-fg --pl-color-accent-solid --pl-color-accent-solid-active --pl-color-accent-solid-hover --pl-color-accent-subtle --pl-color-accent-subtle-hover --pl-color-bg-muted --pl-color-bg-subtle --pl-color-bg-surface --pl-color-border-default --pl-color-border-strong --pl-color-danger-on-solid --pl-color-danger-solid --pl-color-danger-solid-hover --pl-color-fg-default --pl-color-fg-disabled --pl-color-fg-link --pl-color-fg-on-accent --pl-control-height-lg --pl-control-height-md --pl-control-height-sm --pl-focus-ring-color --pl-focus-ring-offset --pl-focus-ring-width --pl-font-size-lg --pl-font-size-md --pl-font-size-sm --pl-radius-full --pl-radius-lg --pl-radius-md --pl-radius-none --pl-radius-sm --pl-shadow-xs
CloseButton
Renders IconButton, so its hooks apply too.
CSS variables
| Variable | Default |
|---|---|
--pl-button-radius | var(--pl-radius-md |
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-disabled] | present when on |
[data-full-width] | present when on |
[data-loading] | present when on |
[data-radius] | none · sm · md · lg · full |
[data-size] | sm · md · lg |
[data-variant] | primary · secondary · tertiary · outline · ghost · destructive · link |
Theme tokens it reads
--pl-color-accent-fg --pl-color-accent-solid --pl-color-accent-solid-active --pl-color-accent-solid-hover --pl-color-accent-subtle --pl-color-accent-subtle-hover --pl-color-bg-muted --pl-color-bg-subtle --pl-color-bg-surface --pl-color-border-default --pl-color-border-strong --pl-color-danger-on-solid --pl-color-danger-solid --pl-color-danger-solid-hover --pl-color-fg-default --pl-color-fg-disabled --pl-color-fg-link --pl-color-fg-on-accent --pl-control-height-lg --pl-control-height-md --pl-control-height-sm --pl-focus-ring-color --pl-focus-ring-offset --pl-focus-ring-width --pl-font-size-lg --pl-font-size-md --pl-font-size-sm --pl-radius-full --pl-radius-lg --pl-radius-md --pl-radius-none --pl-radius-sm --pl-shadow-xs
Accessibility
- The icon is hidden from assistive technology; the label is the accessible name.
- No native title is set (it never appears on keyboard focus); use Tooltip instead.
| Key | Action |
|---|---|
| Enter / Space | Activate |
Usage guidelines
Do
- Use widely understood icons (close, edit, delete, settings).
- Group related icon buttons in a ButtonGroup with a label.
Don’t
- Don’t use icon-only buttons for primary actions.
- Don’t rely on the icon alone for destructive actions — confirm with a Dialog.