GitHub
Core
Glass
Brutal
Humanist

Compact Icon Button

Compact icon buttons are used for actions that can be represented by a single icon in a small space, such as toolbars and inline controls.

Compact Icon Button Playground

Compact Icon Button Playground
Preview
Code
Controls
Variant:
Filled
Outline
Subtle
Size:
Default
Small
Disabled:

Installation

You can add the compact icon button component to your project manually:

1

Install the following dependencies:

npm install @react-aria/button @react-aria/focus @react-aria/interactions
2

Copy and paste the following code into your project.

Loading source code...
3

Update the import paths to match your project setup.

Update the import aliases (e.g. @/components, @/utils) in the copied files to match your project's path configuration.

Basic Usage

A simple icon button with the default filled variant:

import { CompactIconButton } from '@versaui/ui/components/Button';
import { GearIcon } from '@phosphor-icons/react';

<CompactIconButton icon={<GearIcon />} aria-label="Settings" />

Variants

Three visual styles are available:

import { PlusIcon, GearIcon, TrashIcon } from '@phosphor-icons/react';

// Filled (default) — solid background
<CompactIconButton variant="filled" icon={<PlusIcon />} aria-label="Add" />

// Outline — border only
<CompactIconButton variant="outline" icon={<GearIcon />} aria-label="Settings" />

// Subtle — transparent background
<CompactIconButton variant="subtle" icon={<TrashIcon />} aria-label="Delete" />

Size Variants

Two sizes available — default (32px) and small (24px):

<CompactIconButton size="default" icon={<PlusIcon />} aria-label="Add" />
<CompactIconButton size="small" icon={<PlusIcon />} aria-label="Add" />

Disabled State

<CompactIconButton disabled icon={<GearIcon />} aria-label="Settings" />

Accessibility

  • Requires aria-label for screen reader identification
  • Full keyboard navigation with focus ring
  • Proper ARIA attributes for disabled state
  • Uses @react-aria/button for accessible button behavior

CompactIconButton Props

PropTypeDefaultDescription
iconReactNodeRequired. Icon element to display.
variant'filled' | 'outline' | 'subtle''filled'Visual style variant.
size'default' | 'small''default'Button size.
disabledbooleanfalsePrevents interaction.
onClick() => voidClick handler.
aria-labelstringRequired. Accessible label for screen readers.
classNamestring''Additional CSS classes.

On this page