CoverImage
Fixed-aspect media cover with a deterministic seed-derived gradient placeholder for entities without art.
Design intent
Media cards need a cover that never looks broken: imageless entities still get an intentional, per-entity placeholder instead of a reused generic social card. CoverImage wraps Image's src->fallback chain inside an aspect-ratio box so grids stay aligned and never shift layout.
npx @slipstream-ui/cli@latest add cover-imageProps
| Prop | Type | Default | Description |
|---|---|---|---|
| src | string | null | — | Cover URL; the seeded fallback renders when absent or broken. |
| alt | string | — | Required: describes the image content. |
| aspect | 'video' | 'square' | 'wide' | string | 'video' | Aspect ratio preset or any CSS aspect-ratio value. |
| seed | string | — | Stable key selecting the fallback gradient (e.g. entity slug). |
| priority | boolean | false | Load eagerly and fetch at high priority for the LCP image. |
| sizes | string | — | Responsive sizes hint forwarded to the image. |
| fallback | React.ReactNode | — | Custom fallback content; defaults to the seeded gradient. |
| mark | React.ReactNode | — | Optional mark centered on the default gradient. |
| className | string | — | Classes merged onto the aspect-ratio container. |
Anti-patterns
validate_usage is the MCP tool that rejects these mistakes: the same list agents see over MCP and in the canonical markdown.
Don't use it for photos of people
Use Avatar for people and firms; CoverImage is for media covers (events, articles, listings).
tsx// Avoid<CoverImage src={person.photo} alt={person.name} />// Prefer<Avatar src={person.photo} name={person.name} />Don't skip the seed
Without a stable seed the fallback falls back to alt text, so two entities can share a gradient by accident. Pass the entity slug.
tsx<CoverImage src={e.image} alt={e.title} seed={e.slug} />
Accessibility
- Renders a real img with alt when src is present; the gradient fallback is aria-hidden decoration.
- The aspect-ratio box reserves space before the image loads, so grids never shift.
Content guidelines
Alt text
- Describe the image, not the component
- For decorative covers paired with a title, keep alt concise
Good examples
- Fall Classic competition floor
Bad examples
- Cover image
- Photo
Composition
Compose with Card: CoverImage is the media slot at the top of a Card or listing tile
<Card><CoverImage src={item.image} alt={item.title} seed={item.slug} /><CardContent>…</CardContent></Card>
Compose with Image: CoverImage wraps Image, inheriting its src->fallbackSrc->fallback resilience chain
<CoverImage src={url} alt={alt} />
Dependencies
What the registry installs alongside this component. Package imports already include these.
npm packages
- class-variance-authority
- clsx
- tailwind-merge
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+: macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA, the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.