ButtonTriggers a click action usually performed by the user to trigger an event such as submitting a form or closing a dialog.
Button component is used for primary actions, such as submitting forms, confirming decisions, or initiating important processes.
Install the component from your command line.
Import all parts and piece them together.
The
Colors help convey the purpose and importance of actions. The color prop only affects solid and outline variants. Default is
The Button component offers two size options. Default size is
The Button component provides a "disabled" state, which prevents the button from responding to any user actions. Default is
The Button component offers inbuilt loading states. Loading state is used to signify an ongoing process after the user has clicked on the button.
The button component accepts optional leading and/or trailing icons.
npm install @raystack/apsara
import { Button } from '@raystack/apsara/v1' <Button variant="solid" color="accent">Click here!</Button>
Button
component accepts the following props:
variant
: Visual style variant ("solid"
|"outline"
|"ghost"
|"text"
, default: "solid")color
: Color theme ("accent"
|"danger"
|"neutral"
|"success"
, default: "accent")size
: Size of the button ("small"
|"normal"
, default: "normal")disabled
: Whether the button is disabled (boolean, default: false)loading
: Shows a loading spinner inside the button (boolean)loaderText
: Optional text to display next to the loading spinner (ReactNode)leadingIcon
: Icon element to display before button text (ReactNode)trailingIcon
: Icon element to display after button text (ReactNode)maxWidth
: Custom maximum width for the button (string | number)width
: Custom width for the button (string | number)asChild
: Boolean to merge props onto child elementclassName
: Additional CSS class names- All other ButtonHTMLAttributes from React
solid
.
loading...
accent
.
loading...
normal
.
loading...
false
.
loading...
loading...
loading...