Button
A styled button with full htmx integration, ARIA support, and multiple visual variants.
<rhx-button>
Examples
Variants
<rhx-button rhx-variant="neutral">Neutral</rhx-button>
<rhx-button rhx-variant="brand">Brand</rhx-button>
<rhx-button rhx-variant="success">Success</rhx-button>
<rhx-button rhx-variant="warning">Warning</rhx-button>
<rhx-button rhx-variant="danger">Danger</rhx-button>
Appearances
<rhx-button rhx-variant="brand" rhx-appearance="filled">Filled</rhx-button>
<rhx-button rhx-variant="brand" rhx-appearance="outlined">Outlined</rhx-button>
<rhx-button rhx-variant="brand" rhx-appearance="plain">Plain</rhx-button>
Sizes
<rhx-button rhx-variant="brand" rhx-size="small">Small</rhx-button>
<rhx-button rhx-variant="brand">Medium</rhx-button>
<rhx-button rhx-variant="brand" rhx-size="large">Large</rhx-button>
States
<rhx-button rhx-variant="brand" rhx-disabled="true">Disabled</rhx-button>
<rhx-button rhx-variant="brand" rhx-loading="true">Loading</rhx-button>
Shapes
<rhx-button rhx-variant="brand">Default</rhx-button>
<rhx-button rhx-variant="brand" rhx-pill="true">Pill</rhx-button>
<rhx-button rhx-variant="brand" rhx-circle="true" aria-label="Add">+</rhx-button>
Link Buttons
htmx Integration
Click a button...
<rhx-button rhx-variant="brand"
hx-get="/Docs/Components/Button?handler=Greeting"
hx-target="#result" hx-swap="innerHTML">
Load Greeting
</rhx-button>
<rhx-button rhx-variant="danger" rhx-appearance="outlined"
hx-delete="/Docs/Components/Button?handler=DeleteItem&id=42"
hx-confirm="Are you sure?"
hx-target="#result" hx-swap="innerHTML">
Delete Item
</rhx-button>
Properties
| Property | Type | Default | Description |
|---|---|---|---|
rhx-variant |
string |
neutral |
Color variant: neutral, brand, success, warning, danger |
rhx-appearance |
string |
filled |
Visual style: filled, outlined, plain |
rhx-size |
string |
medium |
Button size: small, medium, large |
rhx-disabled |
bool |
false |
Whether the button is disabled |
rhx-loading |
bool |
false |
Shows a spinner and disables interaction |
rhx-pill |
bool |
false |
Renders with fully rounded corners |
rhx-circle |
bool |
false |
Renders as a circle for icon-only buttons |
rhx-href |
string |
- |
When set, renders as an <a> tag with this URL |
rhx-target |
string |
- |
Link target (e.g. _blank). Only with rhx-href |
rhx-download |
string |
- |
Download filename. Only with rhx-href |
type |
string |
button |
HTML button type: button, submit, reset |
name |
string |
- |
Form submission name |
value |
string |
- |
Form submission value |
aria-label |
string |
- |
Accessible label for icon-only buttons |
Accessibility
- Renders a native
<button>element with full keyboard support. - Use
aria-labelfor icon-only or circle buttons that lack visible text. - Loading state sets
aria-busy="true"and disables interaction. - Link buttons (
rhx-href) render as<a>withrole="button"andaria-disabledwhen disabled. - External links automatically get
rel="noopener noreferrer".