Icon Button

IconButton is an icon-only action for compact toolbars, utility controls, and dense interfaces where a full text label would add unnecessary visual weight.

tsx
import { RiSettings3Line } from '@remixicon/react';
import { IconButton } from '@/components/ui/wideset/button/IconButton';

<IconButton icon={RiSettings3Line} aria-label="Settings" />

Installation

pnpm dlx wideset add icon-button

Copies the component and any Wideset components it uses into your project.

Examples

Variants

The same colour rules as Button: primary for the main action, secondary for quiet utilities in a toolbar, danger for destructive actions, success for a confirming one, inverse on dark or coloured surfaces. The icon is hidden from screen readers, so every icon button needs an aria-label that says what it does.

tsx
import {
  RiAddLine,
  RiCheckLine,
  RiDeleteBinLine,
  RiSettings3Line,
  RiShareLine,
} from '@remixicon/react';
import { IconButton } from '@/components/ui/wideset/button/IconButton';

export default function IconButtonVariants() {
  return (
    <div className="gap-ws-12 flex flex-wrap items-center">
      <IconButton variant="primary" icon={RiAddLine} aria-label="Add member" />
      <IconButton variant="secondary" icon={RiSettings3Line} aria-label="Settings" />
      <IconButton variant="danger" icon={RiDeleteBinLine} aria-label="Delete file" />
      <IconButton variant="success" icon={RiCheckLine} aria-label="Approve request" />
      <div className="bg-ws-static-inverse-background rounded-ws-container-md p-ws-8">
        <IconButton variant="inverse" icon={RiShareLine} aria-label="Share" />
      </div>
    </div>
  );
}

Presets

Filled gives the clearest emphasis, for an icon action that stands alone. Border keeps it visible with less weight. Ghost suits toolbars and table rows, where many icon actions sit side by side and should stay quiet until hovered.

tsx
import { RiEditLine } from '@remixicon/react';
import { IconButton } from '@/components/ui/wideset/button/IconButton';

export default function IconButtonPresets() {
  return (
    <div className="gap-ws-12 flex flex-wrap items-center">
      {(['filled', 'border', 'ghost'] as const).map((preset) => (
        <IconButton key={preset} preset={preset} icon={RiEditLine} aria-label="Edit" />
      ))}
    </div>
  );
}

Sizes

Medium is the default. Extra small and small fit dense toolbars and table rows; large gives the icon more presence and a bigger hit area. Match the size of the buttons next to it.

tsx
import { RiMore2Line } from '@remixicon/react';
import { IconButton } from '@/components/ui/wideset/button/IconButton';

export default function IconButtonSizes() {
  return (
    <div className="gap-ws-12 flex flex-wrap items-center">
      {(['xs', 'sm', 'md', 'lg'] as const).map((size) => (
        <IconButton key={size} size={size} icon={RiMore2Line} aria-label="More actions" />
      ))}
    </div>
  );
}

States

Hover, press and keyboard focus are live. A disabled icon button cannot be focused, so a keyboard or screen reader user may not find it at all; disable it only while the action is temporarily unavailable, and keep the toolbar's layout the same either way.

tsx
import { RiRefreshLine } from '@remixicon/react';
import { IconButton } from '@/components/ui/wideset/button/IconButton';

export default function IconButtonStates() {
  return (
    <div className="gap-ws-12 flex flex-wrap items-center">
      <IconButton icon={RiRefreshLine} aria-label="Refresh" />
      <IconButton icon={RiRefreshLine} aria-label="Refresh" disabled />
    </div>
  );
}

API reference

NameDescriptionDefault
icon*

Icon rendered as the main visible content of the button.

RemixiconComponentType
—
aria-label

Defines a string value that labels the current element. Accessible action name. Provide this or `aria-labelledby`.

string
—
aria-labelledby

Identifies the element (or elements) that labels the current element. ID of the element naming the action. Provide this or `aria-label`.

string
—
asChild

Whether to render onto a child via Radix Slot. Set its accessible name on IconButton; it is forwarded to the child.

boolean
false
children

Optional child element used when `asChild` is enabled.

ReactNode
—
className

Additional CSS classes merged with the icon button root.

string
—
defaultMotion

Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`.

boolean
true
disabled

Disables the icon button visually and functionally.

boolean
—
iconClassName

Additional CSS classes merged with the rendered icon.

string
—
onClick

Called when the user activates the icon button.

MouseEventHandler<HTMLButtonElement>
—
preset
'border''filled''ghost'
'filled'
size
'xs''sm''md''lg'
'md'
type

Native button type used for form behavior.

'button''submit''reset'
'button'
variant
'primary''secondary''danger''success''inverse'
'primary'
Every other prop of <button> is passed through to it. See MDN: <button>.

Accessibility

  • The icon is hidden from screen readers. The props require either aria-label or aria-labelledby; the component does not supply a name.
  • With asChild, pass the naming attribute to IconButton; it is forwarded to the child element.
tsx
import { RiSettings3Line } from '@remixicon/react';
import { IconButton } from '@/components/ui/wideset/button/IconButton';

<IconButton icon={RiSettings3Line} aria-label="Settings" />

Appearance

Variant
Style
Size

State

Disabled