A button is a UI element that triggers an action or event, used to initiate tasks or confirm an action.

Components design versions:

  • Button v3.2.0
  • Navigation button v3.2.0

Note

You can find the OUDS design guidelines here: button guidelines, navigation button guidelines.

Overview

Component types

  • Button is a UI element that triggers an action or event, used to initiate tasks or confirm an action.
  • Navigation button is a UI element that enables movement between different pages within a multi-page interface.

For the two types of button, OUDS Web has a common base .btn class that sets up default styles such as padding and content alignment. By default, .btn controls have a transparent border and background color, but still defines basic focus and hover styles. The .btn class is intended to be used in conjunction with our button variants, or to serve as a basis for your own custom styles. The most basic button is the .btn-default variant.

<button type="button" class="btn btn-default">Default</button>
<button type="button" class="btn btn-next btn-default">Next</button>

Accessibility (semantics)

The .btn classes are designed to be used with the <button> element, but can be used on <a> or <input /> elements (with type equal to button, reset, or submit). You should use any semantic element that best fits the context to appropriately convey its purpose to assistive technologies such as screen readers.

Use a <button> element for actions or for an element that triggers an in-page functionality (like collapsing content), as it is the most semantically correct and accessible choice.

Use an <a> element only for navigation purpose; it must include an href attribute to be focusable. For the navigation button component, we have used <a> elements in our examples, but this could be adapted to your own context.

Generally speaking, you should always ask yourself which tag is appropriate for your specific context. The visual rendering will remain the same anyway:

<button type="button" class="btn btn-default">Standard button</button>
<a class="btn btn-default" href="#">Button link</a>
<input class="btn btn-default" type="button" value="Input button" />
<a class="btn btn-next btn-default" href="#">Navigation button link</a>
html

When navigation buttons are used for global navigation (between pages or within content), they should be wrapped in a <nav> tag, which must have an explicit (accessible) name defined using, for example, an aria-label attribute.

Button

Button is a UI element that triggers an action or event, used to initiate tasks or confirm an action. Button comes in various layouts, styles, and states to convey hierarchy or emphasis.

Variants

OUDS Web includes several button variants, each serving its own semantic purpose, with a few extras thrown in for more control. Please follow the button design specifications to choose the right button variant for the right action.

<button type="button" class="btn btn-default">Default</button>
<button type="button" class="btn btn-strong">Strong</button>
<button type="button" class="btn btn-brand">Brand</button>
<button type="button" class="btn btn-minimal">Minimal</button>
<button type="button" class="btn btn-negative">Negative</button>
html
Bootstrap $enable-bootstrap-compatibility: true

Note

This part is enabled only when $enable-bootstrap-compatibility is set to true.

Read more about Bootstrap compatibility
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-light">Light</button>
<button type="button" class="btn btn-dark">Dark</button>
html

Colored background

OUDS Web offers a few variations to use on colored backgrounds. Their accessibility (readability) is ensured by suitable semi-opaque backgrounds, which are obtained by adding the class btn-on-colored-bg.

Heads up!

Heads up!

  • Background utilities used to make colored backgrounds, should always be used with the appropriate color theme (see an example below). Please refer to colored backgrounds documentation.
  • Negative and brand buttons should never be used on colored background.
<div class="bg-surface-brand-primary p-large">
  <div data-bs-theme="light" class="d-flex gap-xsmall flex-wrap">
    <button type="button" class="btn btn-default btn-on-colored-bg">Default</button>
    <button type="button" class="btn btn-strong btn-on-colored-bg">Strong</button>
    <button type="button" class="btn btn-minimal btn-on-colored-bg">Minimal</button>
    <!-- BEWARE: `.btn-negative` and `.btn-brand` should never be used on colored backgrounds! -->
  </div>
</div>
<div class="bg-surface-status-negative-emphasized p-large">
  <div data-bs-theme="root-inverted" class="d-flex gap-xsmall flex-wrap">
    <button type="button" class="btn btn-default btn-on-colored-bg">Default</button>
    <button type="button" class="btn btn-strong btn-on-colored-bg">Strong</button>
    <button type="button" class="btn btn-minimal btn-on-colored-bg">Minimal</button>
    <!-- BEWARE: `.btn-negative` and `.btn-brand` should never be used on colored backgrounds! -->
  </div>
</div>
html

Rounded corners

Rounded corners buttons is a project-wide option therefore all your buttons should either be rounded or not. Add .use-rounded-corner-buttons on a top container (for example <body>) to use rounded corners.

Heads up!

Rounded corners could be used in more emotional, immersive contexts or those tied to specific visual identities. For standard or business-oriented usage, keep the default square corners.

Note

We use a <div> as a parent container because we cannot use <body> in an example.

<div class="use-rounded-corner-buttons">
  <button type="button" class="btn btn-default">Default</button>
  <button type="button" class="btn btn-strong">Strong</button>
  <button type="button" class="btn btn-brand">Brand</button>
  <button type="button" class="btn btn-minimal">Minimal</button>
  <button type="button" class="btn btn-negative">Negative</button>
</div>
html

With icon

Note

The recommended way to use icons is to fill an SVG sprite file, and use currentColor for styling. If really necessary, for example when you have a lot of icons, you can use an icon font. Find out more about using icons.

Text and icon

Heads up!

Icons in text and icon buttons are considered purely decorative, so they should be hidden from assistive technologies using aria-hidden="true", as we’ve done in our examples. See icons accessibility for more info.

You don’t need to apply any spacing utility on the icon to get consistent spacing, as the margin is already handled by OUDS Web.

<div class="p-large d-flex gap-xsmall flex-wrap">
  <button type="button" class="btn btn-default">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
    </svg>
    Default
  </button>
  <button type="button" class="btn btn-strong">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
    </svg>
    Strong
  </button>
  <button type="button" class="btn btn-brand">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
    </svg>
    Brand
  </button>
  <button type="button" class="btn btn-minimal">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
    </svg>
    Minimal
  </button>
  <button type="button" class="btn btn-negative">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
    </svg>
    Negative
  </button>

  <button type="button" class="btn btn-default">
    <span class="icon si si-settings" aria-hidden="true"></span>
    Default
  </button>
</div>

<div class="bg-surface-brand-primary p-large">
  <div data-bs-theme="light" class="d-flex gap-xsmall flex-wrap">
    <button type="button" class="btn btn-default btn-on-colored-bg">
      <svg aria-hidden="true">
        <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
      </svg>
      Default
    </button>
    <button type="button" class="btn btn-strong btn-on-colored-bg">
      <svg aria-hidden="true">
        <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
      </svg>
      Strong
    </button>
    <button type="button" class="btn btn-minimal btn-on-colored-bg">
      <svg aria-hidden="true">
        <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
      </svg>
      Minimal
    </button>

    <button type="button" class="btn btn-default btn-on-colored-bg">
      <span class="icon si si-settings" aria-hidden="true"></span>
      Default
    </button>
  </div>
</div>
html
Icon only

Add .btn-icon to get a squared button, meant to only contain an icon. Make sure to provide an accessible name to your button, either using a .visually-hidden content or an aria-label attribute.

Heads up!

For icon only buttons, we chose to keep the icon hidden from assistive technologies and add a visually hidden label. See icons accessibility for more info.

<div class="p-large d-flex gap-xsmall flex-wrap">
  <button type="button" class="btn btn-icon btn-default">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
    </svg>
    <span class="visually-hidden">Default</span>
  </button>
  <button type="button" class="btn btn-icon btn-strong">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
    </svg>
    <span class="visually-hidden">Strong</span>
  </button>
  <button type="button" class="btn btn-icon btn-brand">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
    </svg>
    <span class="visually-hidden">Brand</span>
  </button>
  <button type="button" class="btn btn-icon btn-minimal">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
    </svg>
    <span class="visually-hidden">Minimal</span>
  </button>
  <button type="button" class="btn btn-icon btn-negative">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
    </svg>
    <span class="visually-hidden">Negative</span>
  </button>

  <button type="button" class="btn btn-icon btn-default">
    <span class="icon si si-settings" aria-hidden="true"></span>
    <span class="visually-hidden">Default</span>
  </button>
</div>

<div class="bg-surface-brand-primary p-large">
  <div data-bs-theme="light" class="d-flex gap-xsmall flex-wrap">
    <button type="button" class="btn btn-icon btn-default btn-on-colored-bg">
      <svg aria-hidden="true">
        <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
      </svg>
      <span class="visually-hidden">Default</span>
    </button>
    <button type="button" class="btn btn-icon btn-strong btn-on-colored-bg">
      <svg aria-hidden="true">
        <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
      </svg>
      <span class="visually-hidden">Strong</span>
    </button>
    <button type="button" class="btn btn-icon btn-minimal btn-on-colored-bg">
      <svg aria-hidden="true">
        <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#heart-empty"/>
      </svg>
      <span class="visually-hidden">Minimal</span>
    </button>

    <button type="button" class="btn btn-icon btn-default btn-on-colored-bg">
      <span class="icon si si-settings" aria-hidden="true"></span>
      <span class="visually-hidden">Default</span>
    </button>
  </div>
</div>
html

Outline buttons

Bootstrap $enable-bootstrap-compatibility: true

Note

This part is enabled only when $enable-bootstrap-compatibility is set to true.

Read more about Bootstrap compatibility

In need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the .btn-outline-* ones to remove all background images and colors on any button.

<button type="button" class="btn btn-outline-primary">Primary</button>
<button type="button" class="btn btn-outline-secondary">Secondary</button>
<button type="button" class="btn btn-outline-success">Success</button>
<button type="button" class="btn btn-outline-danger">Danger</button>
<button type="button" class="btn btn-outline-warning">Warning</button>
<button type="button" class="btn btn-outline-info">Info</button>
<button type="button" class="btn btn-outline-light">Light</button>
<button type="button" class="btn btn-outline-dark">Dark</button>
html

States

Disabled

Make buttons inactive by adding the disabled boolean attribute to any <button> element. Disabled buttons have pointer-events: none applied to, preventing hover and active states from triggering.

<div class="p-large d-flex gap-xsmall flex-wrap">
  <button type="button" class="btn btn-default" disabled>Default</button>
  <button type="button" class="btn btn-strong" disabled>Strong</button>
  <button type="button" class="btn btn-brand" disabled>Brand</button>
  <button type="button" class="btn btn-minimal" disabled>Minimal</button>
  <button type="button" class="btn btn-negative" disabled>Negative</button>
</div>

<div class="bg-surface-brand-primary p-large">
  <div data-bs-theme="light" class="d-flex gap-xsmall flex-wrap">
    <button type="button" class="btn btn-default btn-on-colored-bg" disabled>Default</button>
    <button type="button" class="btn btn-strong btn-on-colored-bg" disabled>Strong</button>
    <button type="button" class="btn btn-minimal btn-on-colored-bg" disabled>Minimal</button>
  </div>
</div>
html

Disabled buttons using the <a> element behave a bit different:

  • Disabled buttons using <a> must include the aria-disabled="true" attribute to indicate the state of the element to assistive technologies, to make it visually appear disabled and disable all pointer-events.
  • Disabled buttons using <a> should not include the href attribute. In case you need to keep the href, please refer to disabled link accessibility warning.
<div class="p-large d-flex gap-xsmall flex-wrap">
  <a class="btn btn-default" aria-disabled="true">Default link</a>
  <a class="btn btn-strong" aria-disabled="true">Strong link</a>
</div>
<div class="bg-surface-brand-primary p-large">
  <div data-bs-theme="light" class="d-flex gap-xsmall flex-wrap">
    <a class="btn btn-default btn-on-colored-bg" aria-disabled="true">Default link</a>
    <a class="btn btn-strong btn-on-colored-bg" aria-disabled="true">Strong link</a>
  </div>
</div>
html

Loading

The loading state of a button indicates that an action is currently processing or taking place. This state provides feedback to users, enhancing user experience.

To make an animated loading state button, you will add in your standard button:

  • An animated <svg>: the animation will differ whether the loading time is known or not.
  • A status message <span>: the message must be updated regularly in order to be vocalized by screen readers; if the loading time is defined, you should indicate the progression.

For example, before loading, your button could be like this:

<button type="button" class="btn btn-default" id="loading-btn-0">
  Download file
  <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
    <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
  </svg>
  <span role="status" id="loading-btn-msg-0" class="visually-hidden d-none"></span>
</button>
html

When the loading starts, you will have to:

  • Add the class .loading-indeterminate (for an unknown loading time) or .loading-determinate (for a known loading time) to the button to provide the appropriate styles and animation.
  • For a known loading time, provide a CSS variable --bs-btn-loading-time to set the loading time. For example, add style="--bs-btn-loading-time: 5s;" to the button, for a 5 seconds loading.
  • Set the disabled state on the button to avoid any unwanted interactions (in case you use a <a> tag, this can be done by setting aria-disabled="true" and removing the href attribute).
  • Remove the .d-none from the status message <span>.
  • Update regularly the status message <span> containing the loading message.

At the end of the loading, you should:

  • Remove the disabled state on the button to restore its interactivity.
  • Remove the class .loading-indeterminate or .loading-determinate to restore the button’s look.
  • Set a final status message in <span>, indicating the loading has ended (so we don’t add again .d-none on this status message).
  • Put the focus back on the button to ensure similar behavior across browsers and not lose the user after changes.

You can see it live and find a JavaScript example on our loading buttons live example.

<div class="p-large d-flex gap-xsmall flex-wrap">
  <button type="button" class="btn btn-default loading-indeterminate" id="loading-btn-1" disabled>
    Download file 1
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-1" class="visually-hidden">Downloading file 1</span>
  </button>
  <button type="button" class="btn btn-strong loading-indeterminate" id="loading-btn-2" disabled>
    Download file 2
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-2" class="visually-hidden">Downloading file 2</span>
  </button>
  <button type="button" class="btn btn-brand loading-indeterminate" id="loading-btn-100" disabled>
    Download file 100
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-100" class="visually-hidden">Downloading file 100</span>
  </button>
  <button type="button" class="btn btn-minimal loading-indeterminate" id="loading-btn-3" disabled>
    Download file 3
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-3" class="visually-hidden">Downloading file 3</span>
  </button>
  <button type="button" class="btn btn-negative loading-indeterminate" id="loading-btn-4" disabled>
    Download file 4
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-4" class="visually-hidden">Downloading file 4</span>
  </button>
</div>

<div class="p-large d-flex gap-xsmall flex-wrap">
  <button type="button" class="btn btn-default loading-determinate" id="loading-btn-5" disabled style="--bs-btn-loading-time: 5s;">
    Download file 5
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-5" class="visually-hidden">Downloading file 5: xx%</span>
  </button>
  <button type="button" class="btn btn-strong loading-determinate" id="loading-btn-6" disabled style="--bs-btn-loading-time: 5s;">
    Download file 6
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-6" class="visually-hidden">Downloading file 6: xx%</span>
  </button>
  <button type="button" class="btn btn-brand loading-determinate" id="loading-btn-101" disabled style="--bs-btn-loading-time: 5s;">
    Download file 101
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-101" class="visually-hidden">Downloading file 101: xx%</span>
  </button>
  <button type="button" class="btn btn-minimal loading-determinate" id="loading-btn-7" disabled style="--bs-btn-loading-time: 5s;">
    Download file 7
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-7" class="visually-hidden">Downloading file 7: xx%</span>
  </button>
  <button type="button" class="btn btn-negative loading-determinate" id="loading-btn-8" disabled style="--bs-btn-loading-time: 5s;">
    Download file 8
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-8" class="visually-hidden">Downloading file 8: xx%</span>
  </button>
</div>

<div class="bg-surface-brand-primary p-large">
  <div data-bs-theme="light" class="d-flex gap-xsmall flex-wrap">
    <button type="button" class="btn btn-default btn-on-colored-bg loading-indeterminate" id="loading-btn-9" disabled>
      Download file 9
      <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
        <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
      </svg>
      <span role="status" id="loading-btn-msg-9" class="visually-hidden">Downloading file 9</span>
    </button>
    <button type="button" class="btn btn-strong btn-on-colored-bg loading-indeterminate" id="loading-btn-10" disabled>
      Download file 10
      <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
        <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
      </svg>
      <span role="status" id="loading-btn-msg-10" class="visually-hidden">Downloading file 10</span>
    </button>
    <button type="button" class="btn btn-minimal btn-on-colored-bg loading-indeterminate" id="loading-btn-11" disabled>
      Download file 11
      <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
        <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
      </svg>
      <span role="status" id="loading-btn-msg-11" class="visually-hidden">Downloading file 11</span>
    </button>
  </div>
</div>

<div class="bg-surface-brand-primary p-large">
  <div data-bs-theme="light" class="d-flex gap-xsmall flex-wrap">
    <button type="button" class="btn btn-default btn-on-colored-bg loading-determinate" id="loading-btn-12" disabled style="--bs-btn-loading-time: 5s;">
      Download file 12
      <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
        <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
      </svg>
      <span role="status" id="loading-btn-msg-12" class="visually-hidden">Downloading file 12: xx%</span>
    </button>
    <button type="button" class="btn btn-strong btn-on-colored-bg loading-determinate" id="loading-btn-13" disabled style="--bs-btn-loading-time: 5s;">
      Download file 13
      <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
        <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
      </svg>
      <span role="status" id="loading-btn-msg-13" class="visually-hidden">Downloading file 13: xx%</span>
    </button>
    <button type="button" class="btn btn-minimal btn-on-colored-bg loading-determinate" id="loading-btn-14" disabled style="--bs-btn-loading-time: 5s;">
      Download file 14
      <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
        <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
      </svg>
      <span role="status" id="loading-btn-msg-14" class="visually-hidden">Downloading file 14: xx%</span>
    </button>
  </div>
</div>
html

Loading state can also be combined with all kind of buttons, including icons.

<div class="p-large d-flex gap-xsmall flex-wrap">
  <button type="button" class="btn btn-icon btn-default loading-indeterminate" id="loading-btn-15" disabled>
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#download"/>
    </svg>
    <span class="visually-hidden">Downloading file 15</span>
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-15" class="visually-hidden">Downloading file 15</span>
  </button>
  <button type="button" class="btn btn-icon btn-default loading-determinate" id="loading-btn-16" disabled style="--bs-btn-loading-time: 5s;">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#download"/>
    </svg>
    <span class="visually-hidden">Downloading file 16</span>
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-16" class="visually-hidden">Downloading file 16: xx%</span>
  </button>
  <button type="button" class="btn btn-strong loading-indeterminate" id="loading-btn-17" disabled>
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#download"/>
    </svg>
    Download file 17
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-17" class="visually-hidden">Downloading file 17</span>
  </button>
  <button type="button" class="btn btn-strong loading-determinate" id="loading-btn-18" disabled style="--bs-btn-loading-time: 5s;">
    <svg aria-hidden="true">
      <use xlink:href="/orange/docs/1.1/assets/img/ouds-web-sprite.svg#download"/>
    </svg>
    Download file 18
    <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
      <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
    </svg>
    <span role="status" id="loading-btn-msg-18" class="visually-hidden">Downloading file 18</span>
  </button>
</div>
html

Skeleton

To set the button in skeleton state, it needs to be wrapped in an [aria-busy="true"] container that also has the inert attribute. To get more information, please refer to the skeleton documentation.

<div aria-busy="true" inert>
  <button type="button" class="btn btn-default">Default</button>
</div>
html

Layout

Block buttons

Create responsive stacks of full-width, "block buttons" with a mix of our display and gap utilities. By using utilities instead of button-specific classes, we have much greater control over spacing, alignment, and responsive behaviors.

Please note that these full-width buttons should not be used on desktop screens.

<div class="d-grid gap-small">
  <button class="btn btn-default" type="button">Button</button>
  <button class="btn btn-default" type="button">Button</button>
</div>
html

Here we create a responsive variation, starting with vertically stacked buttons until the md breakpoint, where .d-md-block replaces the .d-grid class, thus nullifying the gap-sm utility. Resize your browser to see them change.

<div class="d-grid gap-small d-md-block">
  <button class="btn btn-default" type="button">Button</button>
  <button class="btn btn-default" type="button">Button</button>
</div>
html

You can adjust the width of your block buttons with grid column width classes. For example, for a half-width "block button", use .col-6. Center it horizontally with .mx-auto, too.

<div class="d-grid gap-small col-6 mx-auto">
  <button class="btn btn-default" type="button">Button</button>
  <button class="btn btn-default" type="button">Button</button>
</div>
html

Additional utilities can be used to adjust the alignment of buttons when horizontal. Here we’ve taken our previous responsive example and added some flex utilities and a margin utility on the button to right-align the buttons when they’re no longer stacked.

<div class="d-grid gap-small d-md-flex justify-content-md-end">
  <button class="btn btn-default me-md-xsmall" type="button">Button</button>
  <button class="btn btn-default" type="button">Button</button>
</div>
html

Disable text wrapping

If you don’t want the button text to wrap, you can add the .text-nowrap class to the button. In Sass, you can set $btn-white-space: nowrap to disable text wrapping for each button.

Navigation button is a UI element that enables movement between different pages within a multi-page interface. Navigation button is typically arranged in a sequence to indicate the user’s current position and provide controls for accessing previous, next, or specific pages.

You can use .btn-previous and .btn-next classes to indicate backward and forward actions in a process or a flow. These classes will add a directional arrow to the left or right of the button text, respectively. As navigation buttons generaly indicate a navigation purpose, in our examples, we have used <a> elements, but this could be adapted to your own context (in that case, don't forget to add an href attribute to make the element focusable). The visual rendering will remain the same anyway:

Previous Next
<a class="btn btn-default btn-previous" href="#">Previous</a>
<a class="btn btn-default btn-next" href="#">Next</a>
<button type="button" class="btn btn-default btn-next">Next</button>
html

Variants

OUDS Web includes several navigation button variants, each serving its own semantic purpose. Please follow the navigation button design specifications to choose the right button variant for the right action.

Heads up!

Beware

The button and the navigation button have the same variants except for the negative, which does not exist for the navigation button.

<a class="btn btn-previous btn-default" href="#">Default</a>
<a class="btn btn-previous btn-strong" href="#">Strong</a>
<a class="btn btn-previous btn-brand" href="#">Brand</a>
<a class="btn btn-previous btn-minimal" href="#">Minimal</a>
<br/>
<a class="btn btn-next btn-default" href="#">Default</a>
<a class="btn btn-next btn-strong" href="#">Strong</a>
<a class="btn btn-next btn-brand" href="#">Brand</a>
<a class="btn btn-next btn-minimal" href="#">Minimal</a>
html

Icon only

Add the class .btn-icon to get a squared button that only contains an icon. Make sure to provide an accessible name to your button, either using a .visually-hidden content or an aria-label attribute.

<a class="btn btn-previous btn-icon btn-default" href="#"><span class="visually-hidden">Previous</span></a>
<a class="btn btn-previous btn-icon btn-strong" href="#"><span class="visually-hidden">Next</span></a>
<a class="btn btn-next btn-icon btn-brand" href="#"><span class="visually-hidden">Next</span></a>
<a class="btn btn-next btn-icon btn-minimal" href="#" aria-label="Next"></a>
html

Colored background

OUDS Web offers a few variations to use on colored backgrounds. Their accessibility (readability) is ensured by suitable semi-opaque backgrounds, which are obtained by adding the class btn-on-colored-bg.

Heads up!

Heads up!

  • Background utilities used to make colored backgrounds, should always be used with the appropriate color theme (see an example below). Please refer to colored backgrounds documentation.
  • Brand buttons should never be used on colored background.
<div class="bg-surface-brand-primary p-large">
  <div data-bs-theme="light" class="d-flex gap-xsmall flex-wrap">
    <a class="btn btn-next btn-default btn-on-colored-bg" href="#">Default</a>
    <a class="btn btn-next btn-icon btn-default btn-on-colored-bg" href="#"><span class="visually-hidden">Next</span></a>
    <a class="btn btn-next btn-strong btn-on-colored-bg" href="#">Strong</a>
    <a class="btn btn-next btn-icon btn-strong btn-on-colored-bg" href="#"><span class="visually-hidden">Next</span></a>
    <a class="btn btn-next btn-minimal btn-on-colored-bg" href="#">Minimal</a>
    <a class="btn btn-next btn-icon btn-minimal btn-on-colored-bg" href="#"><span class="visually-hidden">Next</span></a>
    <!-- BEWARE: `.btn-brand` should never be used on colored backgrounds! -->
  </div>
</div>
<div class="bg-surface-status-negative-emphasized p-large">
  <div data-bs-theme="root-inverted" class="d-flex gap-xsmall flex-wrap">
    <a class="btn btn-next btn-default btn-on-colored-bg" href="#">Default</a>
    <a class="btn btn-next btn-icon btn-default btn-on-colored-bg" href="#"><span class="visually-hidden">Next</span></a>
    <a class="btn btn-next btn-strong btn-on-colored-bg" href="#">Strong</a>
    <a class="btn btn-next btn-icon btn-strong btn-on-colored-bg" href="#"><span class="visually-hidden">Next</span></a>
    <a class="btn btn-next btn-minimal btn-on-colored-bg" href="#">Minimal</a>
    <a class="btn btn-next btn-icon btn-minimal btn-on-colored-bg" href="#"><span class="visually-hidden">Next</span></a>
    <!-- BEWARE: `.btn-brand` should never be used on colored backgrounds! -->
  </div>
</div>
html

Rounded corners

Rounded corners navigation buttons is a project-wide option therefore all your buttons should either be rounded or not. Add .use-rounded-corner-buttons on a top container (for example <body>) to use rounded corners.

Heads up!

Rounded corners could be used in more emotional, immersive contexts or those tied to specific visual identities. For standard or business-oriented usage, keep the default square corners.

Note

We use a <div> as a parent container because we cannot use <body> in an example.

<div class="use-rounded-corner-buttons">
  <a class="btn btn-next btn-default" href="#">Next</a>
  <a class="btn btn-next btn-icon btn-default" href="#"><span class="visually-hidden">Next</span></a>
</div>
html

States

Disabled

Make navigation buttons inactive by:

  • Including the aria-disabled="true" attribute, to indicate the state of the element to assistive technologies, make it visually appear disabled and disable all pointer-events.
  • Removing the href attribute. In case you need to keep the href, please refer to disabled link accessibility warning.

<a class="btn btn-next btn-default" aria-disabled="true">Next</a>
<a class="btn btn-next btn-icon btn-strong" aria-disabled="true"><span class="visually-hidden">Next</span></a>
html

In case you use a <button> element, simply add the disabled boolean attribute to it. Disabled navigation buttons have pointer-events: none applied to, preventing hover and active states from triggering.


<button type="button" class="btn btn-next btn-default" disabled>Next</button>
<button type="button" class="btn btn-next btn-icon btn-strong" disabled><span class="visually-hidden">Next</span></button>
html

Loading

The loading state of a navigation button indicates that an action is currently processing or taking place. This state provides feedback to users, enhancing user experience.

Please refer to the loading state section of the button component for guidelines on how to implement loading states, as well as a JavaScript example and a live demo.


<a class="btn btn-next btn-default loading-indeterminate" id="loading-nav-btn-1" aria-disabled="true">
  Next
  <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
    <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
  </svg>
  <span role="status" id="loading-nav-btn-msg-1" class="visually-hidden">Loading next page</span>
</a>
<a class="btn btn-next btn-icon btn-default loading-determinate" id="loading-nav-btn-2" aria-disabled="true" style="--bs-btn-loading-time: 5s;">
  <span class="visually-hidden">Next</span>
  <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
    <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
  </svg>
  <span role="status" id="loading-nav-btn-msg-2" class="visually-hidden">Loading next page: xx%</span>
</a>
<button type="button" class="btn btn-next btn-default loading-indeterminate" id="loading-nav-btn-3" disabled>
  Next
  <svg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg' class="loader" aria-hidden="true">
    <circle class="loader-inner" cx="20" cy="20" r="17"></circle>
  </svg>
  <span role="status" id="loading-nav-btn-msg-3" class="visually-hidden">Loading next page</span>
</button>
html