Theme-aware gradients
Usegradient on Box when the stops should follow the nearest Silva UI theme. It is a compact, typed API for custom gradients that accepts semantic theme tokens, Radix colour tokens, or valid CSS colour values.
Use semantic stops for UI meaning
Use semantic stops when a gradient has a UI role:primary and primaryActive follow the active theme, including a custom theme. Use named hue tokens such as violet9 and cyan9 for decorative accents. Literal CSS values are useful for one-off brand work, but remain fixed when the theme changes.
- Preview
- Code
Choose the right gradient API
Named gradients and animation are documented in Visuals. Use
gradient when a component needs its own colours, direction, or gradient type.
Gradient options
from and to are required. via, type, and deg are optional.
Theme scopes update gradient stops
Token stops compile to Silva UI CSS variables. The gradient does not need to be rebuilt when its nearestTheme changes: its semantic values resolve in the new scope. The same applies to a custom Vanilla Extract theme that implements the Silva UI contract.
- Preview
- Code
Custom theme example
A gradient inside a custom theme resolves through that wrapper just likebg, color, and component variants do.
- Preview
- Code
Gradient types
- Preview
- Code
deg changes the direction of linear gradients and the start angle of conic gradients. Radial gradients ignore it.
Reuse the generated CSS
UsegradientToCss when a wrapper component or a plain element needs the exact same theme-aware background-image value.
style directly: