DocsBlog
  • 1.0.0

  • light

    dark

    system

    Switch mode
  • Cerberus

    Acheron

    Elysium

Get Started
Components
Data Grid
Styling
Theming

Concepts

OverviewCompositionCerberus ContextTesting

Layout

Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridGroupNewLink OverlayScrollableStackWrap

Components

AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPaginationNewPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

Utilities

Client OnlyDownload TriggerEnvironmentFeature FlagsFocus TrapForFormat ByteFormat NumberFormat Relative TimeFrameHighlightJSON Tree ViewLocaleLocal StoragePortalPresenceShowsplitPropsTheme

Admonition

An abstracted informational component that can be used to display important messages or warnings to users.

  • npm
  • source
  • recipe
import { Admonition } from '@cerberus/react'

Usage

The Admonition component is used to display static messagesto users. It can be used in various contexts, such as error, success, or informational messages.

Palette

The Admonition component can be customized with different color palettes to match the design of your application. You can use any of the state-related palettes along with page.

Usage

Use the usage prop to display the admonition in a different style. The options are filled (default) and outlined.

Primitives

You can utilize the primitive components or style props to customize the admonition.

ComponentDescription
AdmonitionRootThe container for the parts
AdmonitionIndicatorThe icon of the admonition
AdmonitionContentThe content container of the admonition
AdmonitionHeadingThe heading of the admonition
AdmonitionDescriptionThe description body of the admonition

API

Props

The Admonition component is an abstraction of the primitives and accepts the following props:

NameDefaultDescription
headingThe heading title of the Admonition.
iconAn alternative icon to display in the Admonition.
palettepageThe color palette of the Admonition.
usagefilledThe usage of the Admonition. Can be filled or outlined.

Parts

The AdmonitionParts API is an Object containing the full family of components.

Note

It is best to only use the AdmonitionParts if you are building a custom solution. Importing Object based components will ship every property it includes into your bundle, regardless if you use it or not.

NameDescription
RootThe AdmonitionRoot component which is the container of the family.
IndicatorThe AdmonitionIndicator component which is the icon of the admonition
ContentThe AdmonitionContent component which is the container of the admonition
HeadingThe AdmonitionHeading component which is the heading of the admonition
DescriptionThe Admonition component which is the description body of the admonition

The Parts additionally use the following data attributes:

NameValueDescription
data-scopeadmonitionThe scope of the components.
data-partrootThe part of the component.
data-partindicatorThe part of the component.
data-partcontentThe part of the component.
data-partheadingThe part of the component.
data-partdescriptionThe part of the component.

On this page

  • Edit this page on Github
Cerberus Design System | Docs

Note

This is a note admonition that is commonly use to display a page-level informational message.

Copy
import { Box } from '@/styled-system/jsx'
import { Admonition } from '@cerberus/react'

export function BasicDemo() {
  return (
    <Box w="3/4">
      <Admonition heading="Note">
        This is a note admonition that is commonly use to display a page-level informational
        message.
      </Admonition>
    </Box>
  )
}

Heading

This is a page admonition.

Heading

This is a info admonition.

Heading

This is a success admonition.

Heading

This is a warning admonition.

Heading

This is a danger admonition.

Copy

Heading

This is a page admonition.

Heading

This is a info admonition.

Heading

This is a success admonition.

Heading

This is a warning admonition.

Heading

This is a danger admonition.

Copy

Cerberus Forever

President's are temporary, but Cerberus is forever.

Copy
import { Stack } from '@/styled-system/jsx'
import { Admonition, type AdmonitionProps, For } from '@cerberus/react'

export function PaletteDemo() {
  const palettes: AdmonitionProps['palette'][] = ['page', 'info', 'success', 'warning', 'danger']

  return (
    <Stack w="3/4">
      <For each={palettes}>
        {(palette) => (
          <Admonition key={palette} heading="Heading" palette={palette}>
            This is a {palette} admonition.
          </Admonition>
        )}
      </For>
    </Stack>
  )
}
import { Stack } from '@/styled-system/jsx'
import { Admonition, type AdmonitionProps, For } from '@cerberus/react'

export function UsageDemo() {
  const palettes: AdmonitionProps['palette'][] = ['page', 'info', 'success', 'warning', 'danger']

  return (
    <Stack w="3/4">
      <For each={palettes}>
        {(palette) => (
          <Admonition key={palette} heading="Heading" palette={palette} usage="outlined">
            This is a {palette} admonition.
          </Admonition>
        )}
      </For>
    </Stack>
  )
}
import PawIcon from '@/app/components/icons/paw-icon'
import { Box, Circle } from '@/styled-system/jsx'
import { AdmonitionParts } from '@cerberus/react'

export function CustomDemo() {
  return (
    <Box w="3/4">
      <AdmonitionParts.Root
        css={{
          transform: 'skewX(-10deg)',
        }}
      >
        <AdmonitionParts.Indicator>
          <Circle size="6">
            <PawIcon />
          </Circle>
        </AdmonitionParts.Indicator>

        <AdmonitionParts.Content>
          <AdmonitionParts.Heading
            css={{
              color: 'danger.text.initial',
              textTransform: 'uppercase',
            }}
          >
            Cerberus Forever
          </AdmonitionParts.Heading>
          <AdmonitionParts.Description>
            President&apos;s are temporary, but Cerberus is forever.
          </AdmonitionParts.Description>
        </AdmonitionParts.Content>
      </AdmonitionParts.Root>
    </Box>
  )
}