Component
Button
Every pressable action, in six variants and three sizes.
import { Button } from '@loidolt/theme-svelte';
Example
Notes
- With
hrefit renders an<a>and accepts anchor attributes; without one, a<button>. Button-only attributes on a link are a type error rather than silent junk. loadingdisables the press and announces through a persistently-mounted live region — a region mounted alongside its message is silent in most screen readers.variant="text"replaces the formerTextButton.
Props
Generated from the component source, so it cannot drift from the implementation.
| Prop | Type | Default | Notes |
|---|---|---|---|
children required | Snippet | — | |
class | string | — | |
disabled | boolean | false | |
href | string | — | Renders an <a> styled as a button. |
loading | boolean | false | |
loadingLabel | string | 'Loading' | Announced while loading when there is no visible loadingText. |
loadingText | string | — | Visible text swapped in while loading. |
ref bindable | HTMLButtonElement | HTMLAnchorElement | null | null | |
size | ControlSize | 'md' | |
type | never | 'button' | |
variant | ActionVariant | 'default' |
Plus the attributes of Omit<HTMLAnchorAttributes, 'class' | 'type'>andOmit<HTMLButtonAttributes, 'class'>, forwarded to the root element.