sbb-icon component provides a solid way of rendering registered and named icons.
The component will dynamically load an SVG for each icon, avoiding multiple requests to the same icon.
The icon components are not tied to specific icon sets; you can register custom namespaces
and then provide the
sbb-icon with the
name property in the format
Note that if you do not provide a namespace, the default namespace will be used pointing to the
SBB Icons CDN (Work in progress).
<!-- Will use the default namespace -->
Similar to an
<img> element, an icon alone does not convey any useful information for a screen-reader user.
The user of
sbb-icon must provide additional information pertaining to how the icon is used.
Based on the use-cases described below,
sbb-icon is marked as
aria-hidden="true" by default,
but this can be overridden by adding
aria-hidden="false" to the element.
In thinking about accessibility, it is useful to place icon use into one of three categories:
- Decorative: the icon conveys no real semantic meaning and is purely cosmetic.
- Interactive: a user will click or otherwise interact with the icon to perform some action.
- Indicator: the icon is not interactive, but it conveys some information, such as a status.
This includes using the icon in place of a text inside a larger message.
| || ||public|| ||The provided name consisting of the namespace and the name of the icon. If the namespace is missing, the default namespace "sbb" will be used. E.g. |
| || ||public|| || ||When set to |