Button

Action control with native <button> or <a> semantics, variants, loading, and slots for icon/badge.

Examples

Properties

PropertyAttributeDescriptionType nameTypeDefault
variantvariant`primary` | `default` | `success` | `danger` | `warning` | `info` | `light` | `dark` | `transparent` | `ghost` (omit for default outline style)DuoButtonVariant"primary" | "default" | "success" | "danger" | "warning" | "info" | "light" | "dark" | "transparent" | "ghost""default"
sizesize`s` | `m` | `l`DuoButtonSize"s" | "m" | "l""m"
typetype`button` | `submit` | `reset` (button mode only)DuoButtonType"button" | "submit" | "reset""button"
disableddisabledDisables the controlbooleanbooleanfalse
loadingloadingBusy state (`aria-busy`), non-interactive, shows spinnerbooleanbooleanfalse
isLoadingis-loadingAlias for `loading` (migration helper)booleanbooleanfalse
outlineoutlineOutline presentation for supported variantsbooleanbooleanfalse
squaresquareCompact square control (icon in slot); pair with `aria-label` or `aria-labelledby`booleanbooleanfalse
blockblockFull widthbooleanbooleanfalse
hrefhrefWhen non-empty, the control renders as `<a href="…">` instead of `<button>`.stringstring""
targettargetLink target (e.g. `_blank`); safe `rel` defaults apply for `_blank`stringstring""
relrelLink relationship; merged with defaults when `target="_blank"`stringstring""
labellabelText fallback when default slot is emptystringstring""
accessibleLabelaria-labelMirrors host `aria-label` for Lit updates; forwarded to the inner control (use `aria-label` in markup).string | undefinedstring | undefined—
labelledByaria-labelledbyMirrors host `aria-labelledby`; forwarded to the inner control.string | undefinedstring | undefined—
formformId of the form to submit or reset. Reflected as the HTML `form` attribute on the host. When `type` is `submit` or `reset`, a click handler calls `requestSubmit()` / `reset()` on the resolved form, because the native `<button>` inside shadow DOM is not a reliable submitter in all browsers.stringstring""
formTargetform-targetLegacy alias; use `form` instead.stringstring""

Slots

NameDescription
defaultVisible label text (omit when using `square` with `aria-label`)
iconLeading icon (e.g. `<duo-icon>`). Slotted `duo-icon` without `size` defaults to `l`.
badgeTrailing badge or count (e.g. `<duo-badge>` or `<span>`)

Usages

Buttons are used to trigger actions or events within the interface. They help users interact with the system, such as submitting forms, navigating to a new page, or performing specific tasks.

  • Primary variant: Used for the main action on a page, such as “Submit” or “Next.” Only one primary button should be used per section to emphasize the most important action (main call-to-action).
  • Default variant: Used for less prominent actions, providing alternatives to the primary action.

Disabled: Indicates an action that is not currently available. Disabled buttons are unclickable and visually distinct.

Other Considerations

  • Text clarity: Ensure the button text clearly describes the action it will trigger. Use verbs like “Save,” “Delete,” or “Learn more.”
  • Consistent text: Button labels should be concise, ideally no more than 2-3 words.
  • Action-oriented: Button text should be specific and action-oriented (e.g., use “Submit form” rather than just “Submit” when appropriate).