Skip to content

Icon button

Compact square button for icons. A pastel ripple spreads from where you click (or from the centre for Enter and Space), and the border glows with cursor-mapped colour on hover and keyboard focus. It never moves.

  • Ripple
  • requestAnimationFrame
  • pastelColour

icon-button

Hover and click the buttons.

Usage

Drop it in

import
import { IconButton } from "@/app/lib/components/icon-button";
example 1
<IconButton onClick={handleClose}><X size={16} /></IconButton>
<IconButton size="lg"><Heart size={20} /></IconButton>

API

Props

PropTypeDefault
children*ReactNode—
size

Button size. Default: "md"

"sm" | "md" | "lg""md"
disabled

Disabled state

booleanfalse
className

Additional class names

string""

Read from the component's source at build time. * required.

Accessibility

Works with

Cursor
Reacts to where the pointer is, not just whether it's over the element.
Touch
Follows your finger while it's down, then settles a moment after you lift.
Keyboard
Focus lights it up the way the cursor does. Every action has a key.
Reduced motion
Nothing moves or springs. Colour still answers, without drifting.