Motion UIComponentsComponent

Multi-state button

A button whose width, glyph and label morph as it moves between states.

npx shadcn@latest add @motion/multi-state-button

API reference

Components

<MultiStateButton />

Pill button with content crossfade, width morph and optional settle feedback.

state

string

Current state key owned by the consumer.

children

ReactNode

Visible label for the current state.

icon?

ReactNode

Optional leading glyph for the current state.

surfaceClassName?

string = "bg-primary text-primary-foreground"

Surface classes for the current state.

pillClassName?

string = "rounded-md px-5 py-3 text-sm font-medium"

Constant pill styling in every state.

feedback?

MultiStateFeedback = "none"

Feedback fired when state settles.

widthMorph?

boolean = true

Whether the pill animates width via layout projection.

announce?

string

Accessible status text via internal aria-live.

"aria-label"?

string

Accessible button name.

type?

"button" | "submit" = "button"

Button type. Default "button".

disabled?

boolean

Disables the button.

onClick?

() => void

Click handler.

className?

string

Merged onto the button root.