Customization Learn how to customize Cerberus to suit your needs.
Cerberus is a highly customizable tool that allows you to define your own rules and configurations. This page will guide you through the process of customizing Cerberus to suit your needs.
Use global config when: Create your own design system You need low-level control over your settings
Use Cerberus config when: Create app-specific settings You need high-level control over your settings
Use component level when: Create one-off component style changes Build your own custom components
Cerberus is built on top of Panda CSS, which allows you to create custom themes and presets. This is the lowest-level way to customize Cerberus.
We recommend creating a theme
directory and adding a config.ts
file to it. This file will contain your custom theme configuration.
import { defineTheme } from ' @cerberus/panda-preset '
import { semanticTokens } from ' ./semantic-tokens/config '
import { keyframes } from ' ./keyframes '
import { recipes , slotRecipes } from ' ./recipes '
import { textStyles } from ' ./textStyles '
import { tokens } from ' ./tokens '
* This module contains our custom theme to use with Cerberus.
export const yourCustomTheme = defineTheme ( {
Create an entry file in the theme
directory that exports your custom theme as a new preset.
import { definePreset } from ' @pandacss/dev '
import { yourCustomTheme } from ' ./config '
* This module contains our custom preset which registers our custom theme.
export const yourCustomPreset = definePreset ( {
// register your custom theme
yourCustomThemeName : yourCustomTheme ,
// opt-into your theme to be used in static css generation
themes : [ ' yourCustomThemeName ' ] ,
To use your custom theme, you need to tell Panda it exists.
import { defineConfig } from ' @pandacss/dev '
import pandaPreset from ' @pandacss/preset-panda '
import { cerberusPreset , cerberusConfig } from ' @cerberus/panda-preset '
export default defineConfig ({
' ./node_modules/@cerberus/react/src/**/*.{ts,tsx} ' ,
' ./app/**/*.{ts,tsx,js,jsx} ' , // <- Make sure this path is to your project
presets : [pandaPreset , cerberusPreset , yourCustomPreset] ,
Finally, delcare your theme in your entry file.
Note
Be sure you run the `prepare` command to generate your theme into the Panda CSS static files.
import { cx } from ' @cerberus/styled-system/css '
import { Poppins , Recursive } from ' next/font/google '
import { type PropsWithChildren } from ' react '
const poppins = Poppins ( {
weight : [ ' 400 ' , ' 600 ' , ' 700 ' ] ,
variable : ' --font-poppins ' ,
const recursive = Recursive ( {
variable : ' --font-recursive ' ,
export default async function RootLayout ( props : PropsWithChildren < RootProps > ) {
data-panda-theme = " yourCustomThemeName "
className = { cx ( poppins . variable , recursive . variable ) }
This is an easier way to customize Cerberus. You just create a client
abstracted file to define your Cerberus configuration to export as a component.
Create a client
file in your project and define your Cerberus configuration.
} from ' @cerberus-design/react '
} from ' @carbon/icons-react '
import type { PropsWithChildren } from ' react '
* This module provides a Cerberus configuration component which has to be used
* in a client abstraction because of R19 rules around data passing into props.
const icons = defineIcons ( {
accordionIndicator : ChevronDown ,
calendarPrev : ChevronLeft ,
calendarNext : ChevronRight ,
confirmModal : Information ,
promptModal : Information ,
waitingFileUploader : CloudUpload ,
infoNotification : Information ,
successNotification : CheckmarkOutline ,
warningNotification : WarningAlt ,
dangerNotification : WarningFilled ,
selectArrow : ChevronDown ,
selectChecked : Checkmark ,
toggleChecked : Checkmark ,
const config = makeSystemConfig ( {
export default function CerberusConfig ( props : PropsWithChildren <{}> ) {
return < CerberusProvider config = { config } > { props . children } </ CerberusProvider >
Finally, use your configuration in your entry file.
import { Poppins , Recursive } from ' next/font/google '
import { type PropsWithChildren } from ' react '
import { css , cx } from ' @cerberus/styled-system/css '
import CerberusConfig from ' @/context/cerberus-config '
const poppins = Poppins ( {
weight : [ ' 400 ' , ' 600 ' , ' 700 ' ] ,
variable : ' --font-poppins ' ,
const recursive = Recursive ( {
variable : ' --font-recursive ' ,
export default async function RootLayout ( props : PropsWithChildren < RootProps > ) {
className = { cx ( poppins . variable , recursive . variable ) }
This is the easiest way to customize Cerberus. You simply just add custom styles to a component in Cerberus.
Note
Most components in Cerberus support custom styles. More complex components (i.e. components that use slot recipes) will require the Global Configuration option.
import { Button , type ButtonProps } from ' @cerberus/react '
import { css } from ' @cerberus/styled-system '
export function CustomButton ( props : ButtonProps ) {
Some components in Cerberus use icons. You can customize these icons by providing your own icon components.
In your entry file, call defineIcons
with an object that maps icon names to icon components.
The following code replaces all instances of the invalid
icon with a custom Lucide icon.
import { defineIcons } from ' @cerberus/react '
import { cx } from ' @cerberus/styled-system/css '
import { Poppins , Recursive } from ' next/font/google '
import { type PropsWithChildren } from ' react '
import { CircleAlert } from ' lucide-react ' ;
const poppins = Poppins ( {
weight : [ ' 400 ' , ' 600 ' , ' 700 ' ] ,
variable : ' --font-poppins ' ,
const recursive = Recursive ( {
variable : ' --font-recursive ' ,
export default async function RootLayout ( props : PropsWithChildren < RootProps > ) {
className = { cx ( poppins . variable , recursive . variable ) }
data-panda-theme = " cerberus "
The defineIcons
function takes an object that maps icon names to icon components.
export type IconType = CarbonIconType | ElementType
export interface DefinedIcons {
infoNotification ? : IconType
successNotification ? : IconType
warningNotification ? : IconType
dangerNotification ? : IconType