Solid Variants
| BUTTON | CODE | COPY |
|---|---|---|
|
||
|
||
|
||
|
||
|
||
|
Outline Variants
| BUTTON | CODE | COPY |
|---|---|---|
|
||
|
||
|
||
|
||
|
||
|
Sizes
| BUTTON | CODE | COPY |
|---|---|---|
|
||
|
||
|
States
| BUTTON | CODE | COPY |
|---|---|---|
|
||
|
||
|
Icons - Left
| BUTTON | CODE | COPY |
|---|---|---|
|
||
|
||
|
Icons - Right
| BUTTON | CODE | COPY |
|---|---|---|
|
||
|
||
|
Link Buttons
| BUTTON | CODE | COPY |
|---|---|---|
| Go to Dashboard |
|
|
| External Link |
|
|
| Profile |
|
|
| Disabled Link |
|
Documentation
Basic Usage
The Button component can be used as both a button and a link. When `href` is provided, it renders as an anchor tag.
<x-button variant="primary">Click Me</x-button>
Variants
Available variants:
primarysecondarysuccesswarningerrorskyoutline-*(outline-primary, outline-secondary, etc.)
Sizes
Available sizes:
sm- Small buttondefault- Default size (no size prop)lg- Large button
<x-button size="sm" variant="primary">Small</x-button>
Icons
Add FontAwesome icons to buttons:
<x-button variant="primary" icon="save">Save</x-button>
Icon position:
iconPosition="left"- Default, icon on the lefticonPosition="right"- Icon on the right
States
Button states:
disabled- Disables the buttonloading- Shows loading spinner and disables the button
<x-button variant="primary" loading>Loading...</x-button>
Link Support
When `href` is provided, the button renders as an anchor tag:
<x-button href="/dashboard" variant="primary">Go to Dashboard</x-button>
External links:
<x-button href="https://example.com" target="_blank" variant="primary">External Link</x-button>
Button Types
When used as a button (not a link), specify the type:
button- Defaultsubmit- For form submissionreset- For form reset
<x-button type="submit" variant="primary">Submit</x-button>
All Props
size
- string|null
Button size: sm, lg, or null for default
variant
- string (default: secondary)
Button variant: primary, secondary, success, warning, error, sky, or outline-* variants
disabled
- bool (default: false)
Whether the button is disabled
type
- string (default: button)
Button type: button, submit, or reset
icon
- string|null
FontAwesome icon name (without fa- prefix)
iconPosition
- string (default: left)
Icon position: left or right
loading
- bool (default: false)
Show loading spinner
href
- string|null
If provided, renders as a link instead of button
target
- string|null
Link target (e.g., _blank)