Concepts
OverviewCompositionTestingLayout
Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrapComponents
AccordionAdmonitionAvatarButtonCarouselCheckboxComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsProgressPrompt ModalRadioRatingSelectSwitchTableTabsTagTextTextareaToggleTooltipUtilities
Feature FlagsForLocal StoragePortalShowsplitPropsThemeUsage
1import { Theme } from "@cerberus/react"
1<Theme mode="dark">2 This is dark mode3</Theme>
Examples
Basic
Nested
The theme can be nested to apply different appearances to different parts of the tree. This is useful for applying a global appearance and then overriding some parts of it.
Good to know: We use native panda-css attributes to achieve this.
Portalled
Use the asChild
prop to force the appearance of portalled elements like the
popover and modal content.
1import { TooltipParts, Theme, Button } from '@cerberus/react'2import { Box } from 'styled-system/jsx'3
4function PortalledExample() {5 return (6 <TooltipParts.Root>7 <TooltipParts.Trigger asChild>8 <Button>Dark</Button>9 </TooltipParts.Trigger>10
11 <TooltipParts.Positioner>12 <TooltipParts.Content asChild>13 <Theme mode="dark">14 <Box bgColor="page.bg.200" p="md" w="full">15 This is a dark mode tooltip bubble16 </Box>17 </Theme>18 </TooltipParts.Content>19 </TooltipParts.Positioner>20 </TooltipParts.Root>21 )22}
Page Specific Color Mode
To lock a page to a specific color mode (light or dark), wrap the entire page
with the Theme
component.
1import { Theme } from "@cerberus/react"2
3export default Page = ({ children }) => {4 return (5 <Theme mode="dark">{/* Rest of the page */}</Theme>6 )7}
On this page