EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
Collapsible·component·@astryxdesign/core

Collapsible Group

Coordinates multiple Collapsible instances so only one (single mode) or any number (multiple mode) can be open at a time. Renders no wrapper DOM element unless dividers are enabled.

Open in Playground @astryxdesign/core/Collapsible

Showcases and examples

2 documented examples

Collapsible Group

CollapsibleGroup coordinates its Collapsible children: with type="single", opening one closes the others. No state or handlers in the example — the group owns which value is open and each child only declares its own. One Collapsible per Card, so each trigger keeps its default large type as the heading of its own surface.

Preview loads on approachPreview loads on approach
Exact source · collapsible-group-showcase
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {Collapsible, CollapsibleGroup} from '@astryxdesign/core/Collapsible';
import {Card} from '@astryxdesign/core/Card';
import {Text} from '@astryxdesign/core/Text';
import {Stack} from '@astryxdesign/core/Stack';

/**
 * The whole point of the group: open one section and the others close
 * themselves. Nothing here tracks that — no state, no handlers — the group
 * owns which `value` is open and the children only declare their own.
 *
 * One Collapsible per Card, so each trigger keeps its own `large` type: it is
 * the heading of its surface, not a row in a list. Compare the FAQ block,
 * where the questions share a surface and step down to body-semibold.
 */
export default function CollapsibleGroupShowcase() {
  return (
    <CollapsibleGroup type="single" defaultValue="shipping">
      <Stack gap={2} width="100%" maxWidth={420}>
        <Card>
          <Collapsible trigger="Shipping" value="shipping">
            <Text type="body" color="secondary">
              Standard delivery takes 3–5 business days and is free over $50.
              Express is next business day if you order before 2pm.
            </Text>
          </Collapsible>
        </Card>

        <Card>
          <Collapsible trigger="Returns" value="returns">
            <Text type="body" color="secondary">
              30 days from delivery, unused and in the original packaging.
              Return shipping is on us for anything that arrived damaged or was
              not what you ordered.
            </Text>
          </Collapsible>
        </Card>

        <Card>
          <Collapsible trigger="Payment" value="payment">
            <Text type="body" color="secondary">
              All major cards, PayPal, and bank transfer. Cards are charged when
              the order ships, not when it is placed.
            </Text>
          </Collapsible>
        </Card>
      </Stack>
    </CollapsibleGroup>
  );
}

Usage

Coordinates multiple Collapsible instances so only one (single mode) or any number (multiple mode) can be open at a time. Renders no wrapper DOM element unless dividers are enabled.

Typed props

PropType and behavior
type'single' | 'multiple' · default 'single'
Whether one or many items can be open simultaneously.
defaultValuestring | string[]
Default open item(s) for uncontrolled usage. Use a string for single mode and an array for multiple mode.
valuestring | string[]
Controlled open item(s).
onChange(value: string | string[]) => void
Callback invoked when the set of open items changes.
hasDividersboolean · default false
Whether to draw hairline dividers between the group's items. When set, the group renders a wrapper div and items default to 'balanced' density. Pair with bare Collapsible children; Card-wrapped items provide their own separation.
density'compact' | 'balanced' | 'spacious'
Row density controlling trigger and content block padding on the group's items. Defaults to 'balanced' when dividers are shown; otherwise items keep their default unpadded look.
chevronPosition'start' | 'end' · default 'end'
Logical position shared by the group's direct Collapsible items. end is the default trailing indicator; start is a leading disclosure arrow that points inward when collapsed (mirrored under RTL) and down when expanded. An individual Collapsible can still override it.
childrenReactNode · required
Collapsible instances to coordinate.