Skip to content

Latest commit

 

History

History
95 lines (71 loc) · 3.94 KB

File metadata and controls

95 lines (71 loc) · 3.94 KB
layout title description group aliases toc added
docs
Focus ring
Utility classes that allows you to add and modify custom focus ring styles to elements and components.
helpers
/docs/helpers/focus-ring/
true
version
5.3

The .focus-ring helper removes the default outline on :focus, replacing it with a box-shadow that can be more broadly customized. The new shadow is made up of a series of CSS variables, inherited from the :root level, that can be modified for any element or component.

Example

Click directly on the link below to see the focus ring in action, or into the example below and then press Tab.

See Bootstrap examples that are incompatible with Orange Design System.
{{< design-callout-alert >}} This helper should not be used because the rendering provided in the following examples does not respect the Orange Design System specifications. {{< /design-callout-alert >}}

{{< example >}} Custom focus ring {{< /example >}}

Customize

Modify the styling of a focus ring with our CSS variables, Sass variables, utilities, or custom styles.

CSS variables

Modify the --bs-focus-ring-* CSS variables as needed to change the default appearance.

See Bootstrap examples that are incompatible with Orange Design System.
{{< design-callout-alert >}} This helper should not be used because the rendering provided in the following examples does not respect the Orange Design System specifications. {{< /design-callout-alert >}}

{{< example >}} Green focus ring {{< /example >}}

.focus-ring sets styles via global CSS variables that can be overridden on any parent element, as shown above. These variables are generated from their Sass variable counterparts.

{{< scss-docs name="root-focus-variables" file="scss/_root.scss" >}}

By default, there is no --bs-focus-ring-x, --bs-focus-ring-y, or --bs-focus-ring-blur, but we provide CSS variables with fallbacks to initial 0 values. Modify them to change the default appearance.

{{< example >}} Blurry offset focus ring {{< /example >}}

Sass variables

Customize the focus ring Sass variables to modify all usage of the focus ring styles across your Boosted-powered project.

{{< scss-docs name="focus-ring-variables" file="scss/_variables.scss" >}}

Sass utilities API

In addition to .focus-ring, we have several .focus-ring-* utilities to modify the helper class defaults. Modify the color with any of our [theme colors]({{< docsref "/customize/color-theme#theming" >}}). Note that the light and dark variants may not be visible on all background colors given current color mode support.

See Bootstrap examples that are incompatible with Orange Design System.
{{< design-callout-alert >}} This helper should not be used because the rendering provided in the following examples does not respect the Orange Design System specifications. {{< /design-callout-alert >}}

{{< example >}} {{< focus-ring.inline >}} {{- range (index $.Site.Data "theme-colors") }}

{{ title .name }} focus

{{- end -}} {{< /focus-ring.inline >}} {{< /example >}}

Focus ring utilities are declared in our utilities API in scss/_utilities.scss. [Learn how to use the utilities API.]({{< docsref "/utilities/api#using-the-api" >}})

{{< scss-docs name="utils-focus-ring" file="scss/_utilities.scss" >}}