Button
Use a button to run an action such as saving a form or adding a project.
Recommended API
| Property or element | Type | Example initial value | Description |
|---|---|---|---|
as | button or a | button | Use a native form action or link. |
color | primary, danger, light, dark | primary | Choose the semantic color family. |
variant | fill or weak | fill | Choose the amount of visual emphasis. |
display | inline, block, full | inline | Set intrinsic, row or edge-to-edge width. |
size | small, medium, large, xlarge | xlarge | Set minimum height, horizontal padding and radius. |
loading | Boolean | false | Show a busy state and block repeated activation. |
disabled | Boolean | false | Prevent activation and apply muted styling. |
type | button, submit, reset | button | Select the native form action. |
href | URL string | — | Supply the destination when as is a. |
style / htmlStyle | CSS declarations | — | Apply styles and Quark button token overrides. |
children | Snippet, node or slot | — | Render the accessible action label or icon. |
click | MouseEvent callback | — | Run the action while it is available. |
States
| State | Trigger | Result |
|---|---|---|
pressed | Hold an enabled button down. | The feedback layer darkens the surface while the button scales down. |
loading | Set loading to true. | Three dots appear, the width is retained and activation is blocked. |
disabled | Set disabled to true. | The inactive button is muted and cannot be activated. |
Svelte implementation guidance
A native action or link with separate background, content, press feedback, and loading layers. Press feedback darkens the background. Loading preserves the label and width while blocking repeat actions.
Save the copied source as Button.svelte. Pass children as a snippet, onclick as a callback, and custom CSS declarations as a string in style.
CSS variables
| Variable | Type | Default | Description |
|---|---|---|---|
--q-text | color | #28302a | Main text and foreground color. |
--q-muted | color | #70776f | Color for secondary text. |
--q-font-size | length | 13px | Base size for the component text. |
--q-accent | color | #344e41 | Accent for active controls, indicators and focus. |
--q-on-accent | color | #ffffff | Foreground on the accent background. |
--q-surface | color | #ffffff | Surface for controls and cards. |
--q-border | color | #dce0d8 | Color for outlines and dividers. |
--q-border-width | length | 1px | Thickness of the outline. |
--q-radius | length | 10px | Base corner radius. |
--q-gap | length | calc(var(--q-space) * 2) | Space between items, based on the spacing unit. |
--q-control-px | length | calc(var(--q-space) * 4) | Horizontal padding for controls. |
--q-control-py | length | calc(var(--q-space) * 2.5) | Vertical padding for controls. |
--q-shadow | shadow | 0 4px 16px rgb(0 0 0 / 8%) | Shadow behind raised elements. |
--q-duration | time | 175ms | Duration of visual state transitions. |
--q-space | length | 4px | Base unit for gaps and padding. |