Skip to content

Gradient backgrounds

Usage

Every layout primitive (Section, Box, Card, Flex, Grid, Container) accepts a mesh preset through bgOverlays. Add the -animated suffix for a slow drift. The presets are CSS gradients that ship free in @shavin/ui and need no registration.

Try a preset

A mesh behind a card, the way blocks use it.

Animated

Ship the first draft

The mesh sets the mood, the card keeps the text readable.

Component Source
<Section bgOverlays="mesh-night-animated" size="body">
  <Container size="sm">
    <Card padding="lg">…</Card>
  </Container>
</Section>

All presets

Follows your theme

Uses the brand and canvas tokens, so it re-tints with the theme.

Dark atmospheres

Fixed palettes for dark sections.

Light pastels

Fixed palettes for light sections.

Component Source
<Box bgOverlays="mesh-night">…</Box>
<Box bgOverlays="mesh-peach-animated">…</Box>
<Box bgOverlays="mesh-brand">…</Box>

FX backgrounds (Pro)

The same bgOverlays prop can also hold an fx layer: an animated WebGL or canvas effect from @shavin/fx (Pro). Register the effects once on the client, then any layout primitive or Image can use one.

Register and use an FX background

registerFxBackdrops() installs the effects as Backdrop variants, and the layer picks one by fxKey.

There are 40 effects, listed in FX_BACKDROPS by docs slug (mesh-gradient, fluid-silk, light-blades, dot-globe, stipple, type-tiles, …). Each takes fxParams as strings (numbers, colours, palettes, options, text, image URLs). Unregistered keys fall back to the built-in CSS mesh backdrop. Exported blocks that use an fx background need the consumer to install @shavin/fx and call registerFxBackdrops().

Component Source
import { registerFxBackdrops } from "@shavin/fx";

registerFxBackdrops(); // once, in a client bootstrap

// then, on any layout or <Image>:
<Section bgOverlays={JSON.stringify([
  { type: "fx", fxKey: "liquid-chrome", opacity: 100, visible: true,
    fxParams: { speed: "0.5" } },
])}>
  …
</Section>

Notes

Fixed palettes (everything except mesh-brand) do not follow the theme, so put content on a Card or check text contrast against them. For animated shader backgrounds, see Backdrop and Mesh gradient.

Configure Theme
Theme
Brand Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font