# Badges, Buttons & Icons {octicon}`rocket` (badges)= ## Badges Inline badges can be used as a labelling component. Badges are available in each semantic color, with filled and outline variants: - {bdg}`plain badge` - {bdg-primary}`primary`, {bdg-primary-line}`primary-line` - {bdg-secondary}`secondary`, {bdg-secondary-line}`secondary-line` - {bdg-success}`success`, {bdg-success-line}`success-line` - {bdg-info}`info`, {bdg-info-line}`info-line` - {bdg-warning}`warning`, {bdg-warning-line}`warning-line` - {bdg-danger}`danger`, {bdg-danger-line}`danger-line` - {bdg-light}`light`, {bdg-light-line}`light-line` - {bdg-muted}`muted`, {bdg-muted-line}`muted-line` - {bdg-dark}`dark`, {bdg-dark-line}`dark-line` - {bdg-white}`white`, {bdg-white-line}`white-line` - {bdg-black}`black`, {bdg-black-line}`black-line` `````{dropdown-syntax} ````{tab-set-code} ```{literalinclude} ./snippets/myst/badge-basic.txt :language: markdown ``` ```{literalinclude} ./snippets/rst/badge-basic.txt :language: rst ``` ```` ````` `bdg-link-` and `bdg-ref-` variants are also available for use with links and references. The syntax is the same as for the `ref` role. {bdg-link-primary}`https://example.com` {bdg-link-primary-line}`explicit title ` {bdg-ref-primary}`badges` `````{dropdown-syntax} ````{tab-set-code} ```{literalinclude} ./snippets/myst/badge-link.txt :language: markdown ``` ```{literalinclude} ./snippets/rst/badge-link.txt :language: rst ``` ```` ````` ### Badge tooltips Any badge can be given a tooltip (shown on hover, via the HTML `title` attribute) by appending a `; tooltip` suffix to its text. This works for every badge family: {bdg-primary}`stable ; A released, supported version` {bdg-link-info}`docs ; Opens the documentation` {bdg-ref-primary}`badges ; Jump to the badges section` ````{tab-set-code} ```markdown {bdg-primary}`stable ; A released, supported version` {bdg-link-info}`docs ; Opens the documentation` {bdg-ref-primary}`badges ; Jump to the badges section` ``` ```rst :bdg-primary:`stable ; A released, supported version` :bdg-link-info:`docs ; Opens the documentation` :bdg-ref-primary:`badges ; Jump to the badges section` ``` ```` The tooltip is the text after the **last** unescaped semicolon; both the badge text and the tooltip are stripped of surrounding whitespace. To include a literal semicolon in the badge text, escape it as `\;` (for example `` {bdg}`step 1\; step 2` ``); a trailing bare `;` (with nothing after it) is not treated as a tooltip and is kept in the badge text. Because semicolons are valid in URLs and reference targets, the link and reference badges (`bdg-link-*`, `bdg-ref-*`) only recognise the tooltip suffix after the explicit `text ` form -- a bare target such as `` {bdg-link-primary}`https://example.com/a;b` `` is never split. To add a tooltip to a link/ref badge, use the explicit form: `` {bdg-link-primary}`docs ; Opens the docs` ``. A `bdg-ref` tooltip overrides the reference's automatic title. ```{warning} `title` tooltips are **not** accessible to keyboard or touch users, and are not surfaced by all screen readers. Do not put essential information in a tooltip alone -- keep it in the visible badge text (or nearby prose) as well. ``` See [Bootstrap badges](https://getbootstrap.com/docs/5.0/components/badge/) for more information, and related [Material Design chips](https://material.io/components/chip). (buttons)= ## Buttons Buttons in Sphinx Design are actually links: - Links that can be styled to look like [Bootstrap buttons](https://getbootstrap.com/docs/5.0/components/buttons/) - Links that are either external (`button-link`) or internal (`button-ref`) Most of the time, you should create links using the link syntax for the language you've chosen: - [Markdown/MyST links and cross-references](https://myst-parser.readthedocs.io/en/latest/syntax/cross-referencing.html#examples) - [rST links and cross-references](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks) Sometimes, though, you may want to call attention to a particular link or set of links, or set them apart visually from other links on the site. :::{admonition} Note on accessibility Despite the name, `button-link` and `button-ref` do **not** convert to `