Button
Versatile, accessible button component with 12 visual variants, 8 sizes, rounded and full-width options, plus a built-in loading state.
Installation
Install via CLI
npx @moontra/moonui-cli add buttonUsage
Examples
Basic Variants
Core button styles for common actions.
Success Variant
Success button for positive actions.
Premium Variants
Eye-catching gradient, glow, soft, glass, and neon styles.
Button Sizes
From extra small to extra large.
Icon Only Buttons
Compact buttons with just icons using the icon sizes.
With Icons
Place icons inline with the button label via children.
Left & Right Icons
Use the built-in leftIcon and rightIcon props instead of manual children.
Loading State
The loading prop shows a built-in spinner and disables the button.
Disabled States
Disabled buttons for unavailable actions.
Full Width Buttons
The fullWidth prop makes buttons span their container.
Rounded Variants
Control corner rounding with the rounded prop.
Real-world Examples
Common button patterns in applications.
Link Button (asChild)
With asChild, button styles are applied to your own element through Radix Slot: the navigation action renders as a single real <a>, so middle-click, opening in a new tab, and the browser's status bar all work — no <a> ends up nested inside a <button>. Variant classes, the loading spinner, and the left/right icons are carried into the child via Slottable, so nothing is lost from the button's contract. For in-app routing, use Next.js Link instead of <a>.