Skip to content

Icon Button

A square button that displays only an icon, with no visible text label. Use for compact toolbars, action menus, and inline controls where the icon meaning is universally understood.

Preview

Sizes

States

Variants

  • Primary -- solid brand fill. Use for the single most important icon action.
  • Secondary -- transparent with border. Use for supporting icon actions.
  • Ghost -- no fill or border. Use in toolbars or dense layouts.
  • Danger -- solid red fill. Use for destructive actions like delete.

Sizes

SizeDimensionsIcon size
sm32 × 32 px16 × 16 px
md40 × 40 px20 × 20 px
lg48 × 48 px24 × 24 px

States

StateAppearance
DefaultResting state
HoverBackground shift matching the text button variant
Focus2 px brand-purple ring with 2 px offset
ActiveDarker background than hover
Disabled50 % opacity, cursor: not-allowed

Props

PropTypeDefaultDescription
variant'primary' | 'secondary' | 'ghost' | 'danger''ghost'Visual style
size'sm' | 'md' | 'lg''md'Button dimensions
disabledbooleanfalseDisables interaction
aria-labelstringrequiredAccessible name (no visible text)
iconReactNode--Icon element to render
classNamestring--Additional CSS classes

Code example

React

tsx
import { IconButton } from '@thepace/lexicon/components';
import { PlusIcon, TrashIcon } from '@thepace/lexicon/icons';

<IconButton variant="ghost" aria-label="Add item" icon={<PlusIcon />} />
<IconButton variant="danger" aria-label="Delete" icon={<TrashIcon />} />

Vanilla HTML

html
<button class="lex-icon-button lex-icon-button--ghost lex-icon-button--md"
        aria-label="Add item">
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none"
       stroke="currentColor" stroke-width="2" stroke-linecap="round">
    <line x1="10" y1="4" x2="10" y2="16"/>
    <line x1="4" y1="10" x2="16" y2="10"/>
  </svg>
</button>

CSS class reference

ClassPurpose
.lex-icon-buttonBase styles
.lex-icon-button--primaryPrimary variant
.lex-icon-button--secondarySecondary variant
.lex-icon-button--ghostGhost variant
.lex-icon-button--dangerDanger variant
.lex-icon-button--smSmall size (32 px)
.lex-icon-button--mdMedium size (40 px)
.lex-icon-button--lgLarge size (48 px)

Accessibility

  • aria-label is required since there is no visible text label.
  • Focus ring matches the standard Button focus style.
  • Keyboard: Enter and Space trigger the action.
  • If the icon conveys meaning beyond the label, mark the <svg> with role="img" and a <title>.

Guidelines

Do

  • Always provide a descriptive aria-label (e.g. "Close dialog", not "X").
  • Use ghost variant in toolbars to keep visual density low.
  • Pair with a Tooltip for discoverability when the icon meaning may not be obvious.

Don't

  • Don't omit aria-label — the button will be invisible to screen readers.
  • Don't use icon buttons for primary page actions where a text label would be clearer.

Released under the MIT License. A product by the pace.