Morph Button
betaA button whose icon and label morph to an active state — toggles, transient confirmations and hover affordances.
- Forms
- 1 file
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add morph-buttonnpm packages installed: class-variance-authority.
import { MorphButton } from "@/components/ui/morph-button";Default
Gallery
Icon Only
Morphs
Transient
Hover
<MorphButton>
| Prop | Type | Default |
|---|---|---|
icon (required)The resting icon. Decorative: it is hidden from assistive technology. | ReactNode | — |
activeControlled active state. | boolean | — |
activeIconThe icon shown while active. Defaults to | ReactNode | — |
activeLabelText shown while active, e.g. "Copied". Defaults to | ReactNode | — |
adornmentDecoration that pops in with the active icon. | "none" | "sparkle" | "dot" | "none" |
announcementAnnounced when a | string | — |
defaultActiveInitial active state when uncontrolled. | boolean | false |
fillOnActiveFills the active icon with its stroke colour — bookmark, like, favourite. | boolean | false |
labelVisible text beside the icon. Without it the button is icon-only and **must** be named with | ReactNode | — |
morph | "scale" | "rise" | "tilt" | "scale" |
onActiveChangeCalled whenever the active state changes, from any trigger. | (active: boolean) => void | — |
revertAfterMilliseconds before a | number | 2000 |
tone | "current" | "primary" | "success" | "warning" | "destructive" | "info" | "current" |
triggerWhat drives the active state. - | MorphButtonTrigger | "toggle" |
8/8
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — does not apply
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes