ObjectUIObjectUI
ComponentsDisclosure

Collapsible

Toggle visibility of content

Examples

Basic Collapsible

Schema

import type { SchemaNode } from '@object-ui/types';

interface CollapsibleSchema {
  type: 'collapsible';
  trigger: SchemaNode | SchemaNode[];
  content: SchemaNode | SchemaNode[];
  defaultOpen?: boolean;
}

The body is authored under content, not children: the renderer reads schema.content inside CollapsibleContent, with no children fallback of any kind, and the registration's defaultProps ships content too. A collapsible that puts its body under children is refused by the zod twin — content is required — and paints an empty body wherever nothing validates it.

On this page