Socket
Book a DemoInstallSign in
Socket

@material/focus

Package Overview
Dependencies
Maintainers
15
Versions
288
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/focus

The Material Components Web focus ring utilities

latest
Source
npmnpm
Version
15.0.0-canary.587d8f871.0
Version published
Weekly downloads
626
1291.11%
Maintainers
15
Weekly downloads
 
Created
Source

Focus

This package contains focus-related utilities.

Focus rings

To add a focus ring to an element, ensure the following requirements:

  • The focus ring should be a child of the element which it is offset from.
  • The element which the focus ring is offset from should have a non-static position CSS value. This is because the focus ring has position: absolute and is then positioned relative to its container element.
  • The focus ring can be shown in Sass via focus-ring-theme.show-focus-ring().

See the following example:

<button class="mdc-button">
	<span>Click me!</span>
	<div class="mdc-focus-ring"></div>
</button>
.mdc-button {
  position: relative;
}

.mdc-focus-ring {
  @include focus-ring-theme.static-styles();
  @include focus-ring-theme.theme-styles(focus-ring-theme.$light-theme);
}

.mdc-button:focus-visible .mdc-focus-ring {
  @include focus-ring-theme.show-focus-ring();
}

Keywords

material components

FAQs

Package last updated on 17 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts