Back to library

Button

Use a button to run an action such as saving a form or adding a project.

Recommended API

Property or elementTypeExample initial valueDescription
asbutton or abuttonUse a native form action or link.
colorprimary, danger, light, darkprimaryChoose the semantic color family.
variantfill or weakfillChoose the amount of visual emphasis.
displayinline, block, fullinlineSet intrinsic, row or edge-to-edge width.
sizesmall, medium, large, xlargexlargeSet minimum height, horizontal padding and radius.
loadingBooleanfalseShow a busy state and block repeated activation.
disabledBooleanfalsePrevent activation and apply muted styling.
typebutton, submit, resetbuttonSelect the native form action.
hrefURL string—Supply the destination when as is a.
style / htmlStyleCSS declarations—Apply styles and Quark button token overrides.
childrenSnippet, node or slot—Render the accessible action label or icon.
clickMouseEvent callback—Run the action while it is available.

States

StateTriggerResult
pressedHold an enabled button down.The feedback layer darkens the surface while the button scales down.
loadingSet loading to true.Three dots appear, the width is retained and activation is blocked.
disabledSet 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

VariableTypeDefaultDescription
--q-textcolor #28302aMain text and foreground color.
--q-mutedcolor #70776fColor for secondary text.
--q-font-sizelength 13pxBase size for the component text.
--q-accentcolor #344e41Accent for active controls, indicators and focus.
--q-on-accentcolor #ffffffForeground on the accent background.
--q-surfacecolor #ffffffSurface for controls and cards.
--q-bordercolor #dce0d8Color for outlines and dividers.
--q-border-widthlength 1pxThickness of the outline.
--q-radiuslength 10pxBase corner radius.
--q-gaplength calc(var(--q-space) * 2)Space between items, based on the spacing unit.
--q-control-pxlength calc(var(--q-space) * 4)Horizontal padding for controls.
--q-control-pylength calc(var(--q-space) * 2.5)Vertical padding for controls.
--q-shadowshadow 0 4px 16px rgb(0 0 0 / 8%)Shadow behind raised elements.
--q-durationtime 175msDuration of visual state transitions.
--q-spacelength 4pxBase unit for gaps and padding.