Skip to the content
Konstruktor UI

Actions and inputs

Button

A native <button> for an action, or an <a> for going somewhere, with .kui-button. A pill, 36 pixels high at the default density and 44 on a phone, the same as the Angular kui-button.

CSS only

Examples

Variants

Primary is the one main action of a screen, in the accent. Strong is the website’s monochrome main button. Secondary (the default) is for every other action; ghost for quiet ones in toolbars; danger for an action that destroys.

HTML
<button class="kui-button kui-button--primary" type="button">Save changes</button>
<button class="kui-button kui-button--strong" type="button">Get started</button>
<button class="kui-button" type="button">Cancel</button>
<button class="kui-button kui-button--ghost" type="button">Skip</button>
<button class="kui-button kui-button--danger" type="button">Delete project</button>
<button class="kui-button kui-button--link" type="button">Show details</button>

With an icon, and icon only

The icon comes before the label. An icon-only button needs an aria-label; give it a tooltip when the icon is not obvious.

Download PDF
HTML
<button class="kui-button kui-button--primary" type="button"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#plus"></use></svg><span>New task</span></button>
<a class="kui-button" href="#download"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#download"></use></svg><span>Download PDF</span></a>
<button class="kui-button kui-button--icon" type="button" aria-label="Search"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#search"></use></svg></button>
<button class="kui-button kui-button--icon kui-button--ghost" type="button" aria-label="More actions"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#ellipsis"></use></svg></button>

Sizes

HTML
<button class="kui-button kui-button--sm" type="button">Small</button>
<button class="kui-button" type="button">Medium</button>
<button class="kui-button kui-button--lg" type="button">Large</button>
<button class="kui-button kui-button--xl kui-button--primary" type="button">Extra large</button>

Button group

Buttons joined into one control, for a few actions on the same thing. To choose one of several values use the segmented control.

HTML
<div class="kui-button-group" role="group" aria-label="Text alignment">
  <button class="kui-button" type="button"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#align-left"></use></svg><span>Left</span></button>
  <button class="kui-button" type="button">Centre</button>
  <button class="kui-button" type="button">Right</button>
</div>

Actions of a form or a dialog

.kui-actions--stack stacks the buttons full width on a phone, the main one on top.

HTML
<div class="kui-actions kui-actions--end kui-actions--stack">
  <button class="kui-button" type="button">Back</button>
  <button class="kui-button kui-button--primary" type="submit">Weiter und Datenschutzerklärung akzeptieren</button>
</div>

States

Every state

Hover darkens the line or lifts the fill with a ring; keyboard focus shows the ring; pressing moves the button down by a pixel. Disabled uses disabled, or aria-disabled="true" to keep it focusable so a person can learn why. Loading is aria-busy="true" with aria-disabled="true": a spinner takes the icon’s place and the label stays.

HTML
<button class="kui-button kui-button--primary" type="button">Default</button>
<button class="kui-button kui-button--primary" type="button" disabled>Disabled</button>
<button class="kui-button kui-button--primary" type="button" aria-disabled="true">Focusable, disabled</button>
<button class="kui-button kui-button--primary" type="button" aria-busy="true" aria-disabled="true"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#save"></use></svg><span>Saving</span></button>
<button class="kui-button" type="button" aria-busy="true" aria-disabled="true"><span>Loading</span></button>

Classes and attributes

.kui-button
The button. Alone it is the secondary, outlined button.
--primary, --strong, --ghost, --danger, --link
The variant. Only one primary per screen.
--sm, --lg, --xl
The size. On a phone every size is at least 44 pixels high.
--icon
Square, icon only. Needs aria-label.
--block
Full width.
.kui-button-group
Joins buttons; give it role="group" and an aria-label.
.kui-actions, --end, --stack
A row of buttons; --stack stacks them on a phone.
aria-busy="true"
Loading: shows a spinner. Add aria-disabled="true" so it cannot be pressed twice.

Keyboard

Enter or Space
Presses a button.
Enter
Follows a link styled as a button.

Accessibility

  • Use a <button> for an action and an <a href> for navigation; never a <div>.
  • The label says what happens: “Save changes”, not “OK”.
  • An icon-only button carries an aria-label; the icon itself is aria-hidden.
  • The accent fill and its text keep 4.5:1 in every shipped theme; the theme check fails otherwise.

Do and do not

Do

  • One primary button per screen or dialog.
  • Put the main action last in a row on a wide screen; the stack puts it first on a phone.
  • Write the verb first: “Send invoice”.

Do not

  • Do not use colour alone to say a button is dangerous: the word says it too.
  • Do not disable a button without saying why nearby.
  • Do not put two primary buttons side by side.