Skip to content
Buttons

MorphAction

The pill shrinks into a spinner while the action runs, draws a tick when it is done, then turns back into the label.

Download
  • React
  • Tailwind CSS v4
  • motion

Props

NameTypeDefaultWhat it does
childrenReactNode—Button label.
onClick() => unknown—Runs on click. Return a promise and the button waits for it; a rejected promise goes straight back to the label.
doneLabelstring"Done"Read out to screen readers when finished.
doneFornumber1.6Seconds the tick stays.
classNamestringviolet pill (colours and type only; the shape is the morph)Replaces the default look.