--- title: Card gradient summary: Card gradients give a card a colored gradient background, in single-color, multi-color, directional and animated variants. description: Gradient card backgrounds, with color variants, multi-color themes, directions and animation. added-in: '1.5.0' related: [/ui/components/card] source: core/scss/ui/_cards.scss css-vars: card-gradient classnames: component: - class: card-gradient desc: Applied with card, fills the card with a gradient style: - class: card-gradient-{preset} desc: Ready-made blends - disco, gold, love, mellow, ocean, psychedelic, rainbow, snow, sun behavior: - class: card-gradient-animated desc: Slowly shifts the gradient direction: - class: card-gradient-bottom desc: Starts the gradient at the bottom edge color: - class: card-gradient-{color} desc: Any base color as the gradient start - class: card-gradient-start desc: Sets the first color stop with a CSS custom property - class: card-gradient-end desc: Sets the second color stop --- import Example from '@components/Example.astro' export const gradients = ['rainbow', 'sun', 'snow', 'ocean', 'mellow', 'disco', 'psychedelic', 'love', 'gold'] ## Default markup Use the `.card-gradient` class on a `.card` element to apply the default gradient treatment. ```html
...
``` The base gradient card:

Total Revenue

Track key metrics in a highlighted card.

## Color variants Add a color class such as `.card-gradient-primary` or `.card-gradient-success` next to `.card-gradient`. Any name from the [color palette](/ui/base/colors) works.

Primary

Success

Danger

Blue

## Named gradients There are also multi-color themes with their own names: {gradients.map((gradient, i) => { return (

{gradient.charAt(0).toUpperCase() + gradient.slice(1)}

) })}
## Direction modifiers The direction classes set where the gradient starts. ```html
...
...
...
```

Start

End

Bottom

## Animated gradient Add `.card-gradient-animated` to animate gradient direction over time.

Animated gradient

Use this variant for visual emphasis on highlight cards.

Animated gradient

Use this variant for visual emphasis on highlight cards.

## Accessibility - Keep text contrast readable on all gradient variants. - Prefer short content blocks on high-saturation gradients. - Avoid using animated gradients on too many cards in one view.