Skip to contentWolf-Rayet

Blanket

A blanket covers the interface behind a layered component, such as a modal dialog or a tooltip.

Install

One package and one stylesheet. The stylesheet holds the tokens every component uses.

pnpm add @wolf-rayet/react
import '@wolf-rayet/react/css/wolf-rayet.css';
import { Blanket } from '@wolf-rayet/react';

Props

A required prop is marked with an asterisk.

PropTypeDefaultDescription
isTintedbooleantrueWhether the blanket darkens what is behind it. Untinted still blocks interaction without dimming.
onBlanketClicked() => voidNoneCalled when someone clicks outside the layer above. Handle it the same way as the close button and Escape.

Accessibility

What the component does for you, and what it needs from you.

  • If clicking the blanket closes the layer, that must not be the only way out. Escape and a close button have to work too. Keyboard and screen reader users cannot find a click target with no name.
  • Hide the content underneath from screen readers while the blanket is up. Otherwise they can move into it.
  • The tint is measured, and is darker in the dark theme.