Skip to contentWolf-Rayet

Image

An image that can switch between light and dark themes.

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 { Image } from '@wolf-rayet/react';

Props

A required prop is marked with an asterisk.

PropTypeDefaultDescription
src *stringNoneThe image source.
alt *stringNoneWhat the image tells people. Use an empty string for a decorative image. That is different from leaving alt out.
widthnumberNoneThe intrinsic width. Give it with height so the layout does not jump when the image loads.
heightnumberNoneThe intrinsic height. Give it with width for the same reason.

Accessibility

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

  • The component requires alt text because it is the part people forget most often.
  • An empty alt tells screen readers the image is decorative, which is correct. A missing alt is not.
  • Setting width and height stops the page moving as the image loads. This matters most to people using magnification.