This button delivers epic animated flair loading rings, shake-on-danger, and green-check triumph handcrafted with Motion. Tweak thy texts or icons, and thou shalt delight users with buttery-smooth transitions.
Determines which icon or text to show based on the variant prop.
Animates text entering and exiting with sliding and fading effects.
Applies distinct animations to each state’s icon.
Wraps the button in MotionConfig to apply the transition prop across all animations.
Prop | Type | Default | Description |
---|---|---|---|
variant | "loading" | "error" | "success" | none | Selects the button’s state and styling. |
children | React.ReactNode | none | Content displayed when no variant is active. |
icon | React.ReactNode | none | Custom icon to render in the default state. |
transition | Transition | { type: "spring", duration: 0.6, bounce: 0.4 } | Motion transition settings for all animations. |
className | string | none | Additional CSS classes for the button container. |
text | { error?: string; loading?: string; success?: string } | none | Override default labels for each variant state. |