Shadows
Shadow design tokens available in the Cerberus Design System.
Overview
Shadow tokens represent the shadow of an element. They provide depth and hierarchy to your interface by creating visual layers. Cerberus provides a set of predefined shadow tokens that you can use throughout your application.
Tokens
Cerberus provides the following shadow tokens:
theme.tokens.shadows
sm
{offsetX: 0, offsetY: 2, blur: 16, spread: 0, color: "hsla(274, 95%, 8%, 0.1)"}
md
{offsetX: 0, offsetY: 0, blur: 20, spread: 4, color: "hsla(274, 95%, 8%, 0.1)"}
lg
{offsetX: 0, offsetY: 0, blur: 20, spread: 8, color: "hsla(274, 95%, 8%, 0.25)"}
Usage
You can use shadow tokens with the shadow
or boxShadow
props:
1import { Box } from "styled-system/jsx"2
3// Using predefined shadow tokens4<Box shadow="sm">Small shadow</Box>5<Box shadow="md">Medium shadow</Box>6<Box shadow="lg">Large shadow</Box>7
8// Using boxShadow prop9<Box boxShadow="md">Medium shadow</Box>
Custom Shadows
You can also define custom shadow tokens in your theme configuration:
1import {2 createCerberusConfig,3 createCerberusPreset,4} from '@cerberus/panda-preset'5
6export default createCerberusConfig({7 presets: [createCerberusPreset()],8
9 include: ['./app/**/*.{ts,tsx}'],10 exclude: [],11
12 theme: {13 extend: {14 tokens: {15 shadows: {16 custom: {17 value: "0 4px 8px rgba(0, 0, 0, 0.1)"18 },19 glow: {20 value: "0 0 20px rgba(59, 130, 246, 0.5)"21 }22 }23 }24 }25 }26})
Shadow Values
The shadow tokens support both string values and composite objects:
String Values
1shadows: {2 simple: { value: "0 1px 3px rgba(0, 0, 0, 0.1)" }3}
Composite Values
1shadows: {2 complex: {3 value: {4 offsetX: 0,5 offsetY: 4,6 blur: 8,7 spread: 0,8 color: "rgba(0, 0, 0, 0.1)"9 }10 }11}
Multiple Shadows
1shadows: {2 layered: {3 value: [4 "0 1px 2px rgba(0, 0, 0, 0.05)",5 "0 4px 8px rgba(0, 0, 0, 0.1)"6 ]7 }8}
On this page