Examples

Variants

The label doubles as a native tooltip unless you pass title.

Preview
Example.tsx
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

Preview
Example.tsx
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

IconButton props
PropTypeDefault
iconrequired
The glyph. Decorative.
ReactNode—
labelrequired
Accessible name. Wrap in Tooltip to show it visually.
string—
variant
Same variants as Button.
ButtonVariant'ghost'
size
Square size.
'sm' | 'md' | 'lg''md'
loading
Loading state; keeps its name.
booleanfalse

CloseButton props

CloseButton props
PropTypeDefault
label
Translate 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

VariableDefault
--pl-button-radiusvar(--pl-radius-md

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[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

VariableDefault
--pl-button-radiusvar(--pl-radius-md

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[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.
Keyboard interactions
KeyAction
Enter / SpaceActivate

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.