Icons are UI elements that triggers an action or event.
On this page
- Interactive icon v1.1.0
- Assistant icon v1.0.0
Overview
Component types
- Interactive icon is a UI element that triggers user interactions, such as opening a tooltip or dropdown, and includes defined interactive states.
- Assistant icon is a UI element that triggers an action or event featuring AI-powered capabilities, such as conversational assistance, content generation, or contextual suggestions.
Accessibility (semantics)
The .icon-interactive, .icon-assistant classes are designed to be used with the <button> element, but can be used on <a> elements. 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.
Generally speaking, you should always ask yourself which tag is appropriate for your specific context. The visual rendering will remain the same anyway.
In any case, do not forget to add an aria-label or a <span class="visually-hidden"> since there is no discernible text for screen reader users.
<button class="icon-interactive" aria-label="Button icon">
<svg aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
</button>
<a class="icon-interactive" href="#">
<span class="visually-hidden">Link icon</span>
<svg aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
</a>
Interactive icon
An interactive icon is a UI element that triggers user interactions, such as opening a tooltip or dropdown, and includes defined interactive states.
The interactive icon can be used alone or within other components. It works well in dense layouts with multiple elements.
<button class="icon-interactive" aria-label="Default interactive icon">
<svg aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
</button>
<button class="icon-interactive" aria-label="Default interactive icon">
<span class="icon si si-settings" aria-hidden="true"></span>
</button>
States
Disabled
Make interactive icons inactive by adding the [disabled] boolean attribute to the <button> element. Disabled interactive icons have pointer-events: none applied to them, preventing hover and active states from triggering.
<button class="icon-interactive" disabled aria-label="Disabled interactive button icon">
<svg aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
</button>
Disabled interactive icons using the <a> element behave a bit different:
- Disabled interactive icons using
<a>must include thearia-disabled="true"attribute to indicate the state of the element to assistive technologies, to make it visually appear disabled and disable allpointer-events. - Disabled interactive icons using
<a>should not include thehrefattribute. In case you need to keep thehref, please refer to disabled link accessibility warning.
<a class="icon-interactive" aria-disabled="true">
<span class="visually-hidden">Disabled interactive icon link</span>
<svg aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
</a>
Loading
The loading state of the component interactive icon 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 interactive icon, you will add in your standard interactive icon:
- 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 interactive icon could be like this:
<button class="icon-interactive" aria-label="Before loading interactive icon">
<svg aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
<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-icon-msg-0" class="visually-hidden d-none"></span>
</button>
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 interactive icon to provide the appropriate styles and animation. - For a known loading time, provide a CSS variable
bs-loading-timeto set the loading time. For example, addstyle="--bs-loading-time: 5s;"to the interactive icon, for a 5 seconds loading. - Set the disabled state on the
<button>element to avoid any unwanted interactions. - Remove the
.d-nonefrom 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>element to restore its interactivity. - Remove the class
.loading-indeterminateor.loading-determinateto restore the interactive icon’s look. - Set a final status message in
<span>, indicating the loading has ended (so we don’t add again.d-noneon this status message). - Put the focus back on the interactive icon to ensure similar behavior across browsers and not lose the user after changes.
<button class="icon-interactive loading-indeterminate" disabled aria-label="Indeterminate loading interactive icon">
<svg aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
<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-icon-msg-1" class="visually-hidden d-none"></span>
</button>
<button class="icon-interactive loading-determinate" style="--bs-loading-time: 5s;" disabled aria-label="Determinate loading interactive icon">
<svg aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
<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-icon-msg-2" class="visually-hidden d-none"></span>
</button>
You can see it live and find a JavaScript example on our loading buttons live example.
Skeleton
To set the interactive icon 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 class="icon-interactive" aria-label="Skeleton interactive icon">
<svg aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
</button>
</div>
Sizes
Interactive icons are designed with maximum and minimum width and height, which constraints their size. They can however take any size within these boundaries.
They can be dimensioned using .decorative-*-icon classes on svg elements.
<button class="icon-interactive" aria-label="Inline style interactive icon" style="width: 2.375rem; height: 2.375rem;">
<svg aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
</button>
<button class="icon-interactive" aria-label="Small interactive icon">
<svg class="decorative-small-icon" aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
</button>
<button class="icon-interactive" aria-label="Large interactive icon">
<svg class="decorative-large-icon" aria-hidden="true">
<use xlink:href="/orange-compact/docs/1.6/assets/img/ouds-web-sprite.svg#heart-empty"/>
</svg>
</button>
Assistant icon
An assistant icon is a UI element that triggers an action or event featuring AI-powered capabilities, such as conversational assistance, content generation, or contextual suggestions.
The assistant icon combines standard interactive icon behaviors with AI-specific visual features to clearly indicate actions enhanced or powered by artificial intelligence.
You can use .icon-assistant class to indicate AI actions in a process or a flow. This class will add a specific icon and border color.
<button class="icon-assistant" aria-label="Default assistant icon"></button>
States
Disabled
Make assistant icons inactive by adding the [disabled] boolean attribute to the <button> element. Disabled assistant icons have pointer-events: none applied to them, preventing hover and active states from triggering.
<button class="icon-assistant" disabled aria-label="Disabled assistant icon"></button>
Disabled assistant icons using the <a> element behave a bit different:
- Disabled assistant icons using
<a>must include thearia-disabled="true"attribute to indicate the state of the element to assistive technologies, to make it visually appear disabled and disable allpointer-events. - Disabled assistant icons using
<a>should not include thehrefattribute. In case you need to keep thehref, please refer to disabled link accessibility warning.
<a class="icon-assistant" aria-disabled="true">
<span class="visually-hidden">Disabled interactive icon link</span></a>
Loading
The loading state of the component assistant icon 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 icon component for guidelines on how to implement loading states, as well as a JavaScript example and a live demo.
<button class="icon-assistant loading-indeterminate" disabled aria-label="Indeterminate loading assistant icon">
<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="assistant-loading-icon-msg-1" class="visually-hidden d-none"></span>
</button>
<button class="icon-assistant loading-determinate" style="--bs-loading-time: 5s;" disabled aria-label="Determinate loading assistant icon">
<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="assistant-loading-icon-msg-2" class="visually-hidden d-none"></span>
</button>
Skeleton
To set the assistant icon 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 class="icon-assistant" aria-label="Skeleton assistant icon"></button>
</div>
Sizes
Assistant icons are designed with maximum and minimum width and height, which constraints their size. They can however take any size within these boundaries.
They can be dimensioned using .decorative-*-icon classes on button elements.
<button type="button" class="icon-assistant" aria-label="First transparent assistant icon" style="width: 2rem; height: 2rem;"></button>
<button class="icon-assistant decorative-large-icon" aria-label="Large assistant icon"></button>