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/reactimport '@wolf-rayet/react/css/wolf-rayet.css';
import { Image } from '@wolf-rayet/react';Props
A required prop is marked with an asterisk.
| Prop | Type | Default | Description |
|---|---|---|---|
| src * | string | None | The image source. |
| alt * | string | None | What the image tells people. Use an empty string for a decorative image. That is different from leaving alt out. |
| width | number | None | The intrinsic width. Give it with height so the layout does not jump when the image loads. |
| height | number | None | The 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.