Text Gradient
JSX style props for applying text gradients using Cerberus tokens
Overview
Text gradients allow you to apply beautiful gradient effects to text content using Cerberus gradient tokens. This is based on the PandaCSS text gradients documentation.
Using textGradient prop
Use the textGradient
prop to apply a gradient to text. The gradient tokens follow the pattern [theme].[mode].[variant]
.
1import { Text } from '@cerberus-design/react'2
3function Example() {4 return (5 <Text textGradient="cerberus.dark.charon-dark">6 This text has a gradient effect7 </Text>8 )9}
Using Cerberus Factory
The Cerberus factory provides a convenient way to apply text gradients with inline styles:
1import { cerberus } from '@cerberus-design/react'2
3function Example() {4 return (5 <cerberus.span textGradient="cerberus.dark.charon-dark">6 This is gradient text using the factory7 </cerberus.span>8 )9}
Live Examples
Here are some examples of text gradients in action:
Charon Dark Gradient
This text uses the Charon light gradient variant.
Nyx dark gradient creates a striking effect.Amphiaraus light gradient for subtle elegance.Available Gradient Tokens
Cerberus provides several gradient variants, each available in light and dark modes:
charon-light
/charon-dark
nyx-light
/nyx-dark
amphiaraus-light
/amphiaraus-dark
styx-light
/styx-dark
thanatos-light
/thanatos-dark
hades-light
/hades-dark
asphodel-light
/asphodel-dark
Advanced
For theme-aware gradients, you can use conditional styles directly on the cerberus factory:
1import { cerberus } from '@cerberus-design/react'2
3function Example() {4 return (5 <cerberus.span6 display="block"7 _cerberusTheme={{8 textGradient: 'cerberus.dark.charon-dark',9 }}10 _acheronTheme={{11 textGradient: 'acheron.dark.charon-dark',12 }}13 >14 Theme-aware gradient text15 </cerberus.span>16 )17}
Style Props Reference
Prop | CSS Property | Token Category |
---|---|---|
textGradient | background-image , background-clip | gradients |
Implementation Notes
- Text gradients use
background-image
withbackground-clip: text
to achieve the effect - The text becomes transparent and the background gradient shows through
- Works best with bold or medium font weights for better visibility
- Supports theme-aware gradients that adapt to light/dark modes
On this page