Skip to content

Buttons

Buttons are implemented using different approaches:

  • Using the native <button> element
  • Using Input Buttons elements like <input type="button"> or <input type="submit">
  • Combining [role=button] with elements like <a>, <div>, etc.

The choice of element depends on the context and the desired behavior of the button.

Basic Button

See the <button> for more details on button variations.

live preview
editable html
<button>
  Button
</button>

Input Types

See more at Input Buttons

live preview
editable html
<input type="button" value="Input Button" />
<input type="submit" value="Input Submit" />
<input type="reset" value="Input Reset" />

Div as Button

See more at [role=button] for more details on button variations.

live preview
editable html
<div role="button">
  &lt;div&gt; as button
</div>

Close Button

Simply add a class="icon-close" to a button or use <span class="icon-close" aria-hidden="true"></span> inside a button if you want to display text.

Accessibility: In case the button does not have text, always add an aria-label (e.g., aria-label="Close") so screen readers announce the button's purpose.

See the Icons documentation for more details on the .icon-close class and its usage.

live preview
editable html
<button aria-label="Close" class="icon-close"></button>

<hr>

<button aria-label="Close" class="secondary">
  Close <span class="icon-close" aria-hidden="true"></span>
</button>