DocsBlog
  • 0.25.3

  • light

    dark

    system

    Switch mode
  • Cerberus

    Acheron

    Elysium

Get Started
Components
Styling
Theming

Concepts

OverviewCompositionTesting

Layout

Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrap

Components

AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin 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.

Collapsible content goes here.
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.

Collapsible content goes here.
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
Cerberus Design System | Docs