Button

qds-button is the reusable native action control. It defaults to type="button"; form submission must be explicit. Load only assets/components/button/qds-button.js for a standalone action. It does not load icon fonts, editors, integrations, or the full component catalog.

Examples

<qds-button>Save changes</qds-button>
<qds-button variant="secondary">Cancel</qds-button>
<qds-button variant="quiet">More options</qds-button>
<qds-button variant="destructive">Delete draft</qds-button>
<qds-button loading label="Saving changes"></qds-button>
<qds-button disabled>Unavailable</qds-button>
<qds-button size="sm">Compact</qds-button>
<qds-button size="lg">Large</qds-button>

The default slot supplies visible content; label supplies fallback text. Use the icon and suffix slots for decorative icons or supplementary content. Mark decorative SVGs aria-hidden="true". An explicit aria-label overrides the accessible name. Avoid interactive children inside any button slot. Use qds-icon-button with an action label for an icon-only action.

Forms and events

<form id="profile">
  <input name="name" required>
  <qds-button type="submit" name="intent" value="save">Save</qds-button>
  <qds-button type="reset" variant="secondary">Reset</qds-button>
</form>
<qds-button type="submit" form="profile">Save profile</qds-button>

button, submit, and reset retain native form validation/reset behavior, including disabled fieldsets. formaction, formenctype, formmethod, formnovalidate, and formtarget override the associated form for a submission. The submit event receives a temporary native button as its submitter; read its name/value or construct new FormData(form, event.submitter) during that event. The temporary submitter is removed after the synchronous submission algorithm.

Pointer, Enter, Space, and element.click() dispatch one cancelable click with { component } detail. event.preventDefault() cancels the form action. disabled and loading block activation; loading also sets aria-busy on the native button. Setting properties does not emit activation. Optional aria-pressed, aria-expanded, and aria-controls are forwarded to the native button for host-controlled toggle/disclosure interactions.

Navigation uses native anchors, preserving URL inspection, open-in-new-tab, history, and browser context menus. Do not use an action button to simulate a link.

<a class="qds-link" href="/reports">View reports</a>
<a class="qds-link" href="https://example.com" target="_blank" rel="noopener noreferrer">
  External report <span aria-hidden="true">↗</span>
  <span class="visually-hidden">(opens in a new tab)</span>
</a>
<style>
  .qds-link { color: var(--link-color, var(--theme-accent-primary, #445e89)); text-underline-offset: .18em; }
  .qds-link:hover { text-decoration-thickness: 2px; }
  .qds-link:focus-visible { outline: 2px solid var(--theme-accent-primary, #445e89); outline-offset: 2px; border-radius: 4px; }
  .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
</style>

Use descriptive link text and announce a new browsing context when appropriate. A navigation item without a destination should be ordinary text, rather than an anchor pretending to be disabled. A link styled as a standalone control should have a minimum 44px target; inline prose links retain normal text flow.

Styling and accessibility

Variants are primary, secondary, quiet, and destructive; sizes are sm, md, and lg. Every size preserves a 44px minimum target. Semantic theme tokens support light/dark colors without token changes. Focus uses a 2px outline with 2px offset; forced colors and reduced motion are supported. CSS parts: button, label, icon, suffix, spinner.

Interactive demonstration includes variants, slots, busy/disabled states, forms, and links.