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

Collapsible

A flexible collapsible section for showing and hiding content.

  • npm
  • source
  • recipe
  • Ark
import { Collapsible } from '@cerberus-design/react'

Usage

The Collapsible component allows you to show or hide content with a trigger. It is useful for accordions, dropdowns, and expandable sections.

Copy
'use client'
import { Collapsible } from '@cerberus/react'
import { Box, HStack } from 'styled-system/jsx'
export function BasicDemo() {
return (
<HStack h="full" w="17rem">
<Collapsible.Root>
<Collapsible.Trigger>Toggle</Collapsible.Trigger>
<Collapsible.Content>
<Box
border="1px solid"
borderColor="page.border.initial"
p="md"
rounded="md"
w="full"
>
Collapsible content goes here.
</Box>
</Collapsible.Content>
</Collapsible.Root>
</HStack>
)
}

Effects

To turn off the animation effect, you can set the effect prop to none on the Collapsible.Content component.

Copy
function FadeInPreview() {
return (
<HStack h="full" w="17rem">
<Collapsible.Root>
<Collapsible.Trigger>Toggle</Collapsible.Trigger>
<Collapsible.Content effect="none">
<Box
border="1px solid"
borderColor="page.border.initial"
p="md"
rounded="md"
w="full"
>
Collapsible content goes here.
</Box>
</Collapsible.Content>
</Collapsible.Root>
</HStack>
)
}

Primitives

You can utilize the primitive components to build a custom collapsible solution.

ComponentDescription
CollapsibleRootThe context provider of the collapsible.
CollapsibleTriggerThe button that toggles the collapsible.
CollapsibleIndicatorThe indicator that shows the state.
CollapsibleContentThe content of the collapsible.

Primitive Selectors

Each primitive component has a data attribute for easy targeting.

NameValueDescription
data-scopecollapsibleThe scope of the components.
data-partrootThe root container part.
data-parttriggerThe trigger part.
data-partindicatorThe indicator part.
data-partcontentThe content part.

API

Collapsible

The Collapsible component is an Object containing all the primitive components.

You can see additional options for the Root component.

Parts

The CollapsibleParts API is the same as the Collapsible component.

On this page

  • Edit this page on Github
Collapsible content goes here.
Collapsible content goes here.
Cerberus Design System | Docs