# Collapsible

shadcn's collapsible (Radix) in Candor's theme.

- Registry name: `collapsible` (`@candor/collapsible`)
- Tier: Free (MIT). No licence key needed.
- Docs: https://candor.themethodic.com/docs/collapsible

## Install

```bash
npx candor-ui add collapsible
```

Run `npx candor-ui@latest init` once first (https://candor.themethodic.com/get-started.md). Without the CLI: `npx shadcn@latest add @candor/collapsible`.
It brings in: render-prop, utils.
npm packages: radix-ui@^1.8.1.

## Example

```tsx
"use client"

import { ChevronDown } from "lucide-react"
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible"

export default function Example() {
  return (
    <Collapsible className="w-full max-w-sm rounded-lg border">
      <CollapsibleTrigger className="group flex w-full items-center justify-between px-3 py-2 text-sm font-medium">
        Why the agent stopped
        <ChevronDown aria-hidden className="size-4 transition-transform group-data-[state=open]:rotate-180" />
      </CollapsibleTrigger>
      <CollapsibleContent className="border-t px-3 py-2 text-sm text-muted-foreground">The run reached its $5.00 budget before the last step.</CollapsibleContent>
    </Collapsible>
  )
}
```

## <Collapsible>

No props.

Also takes the props of `React.ComponentProps<typeof CollapsiblePrimitive.Root>`.

## <CollapsibleTrigger>

No props.

Also takes the props of `React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>`, `RenderProp`.

## <CollapsibleContent>

The content opens and closes to the height Radix measured (--radix-collapsible-content-height), so a change of state is seen settling rather than snapping; data-motion="none" and the OS's reduced-motion setting make it snap.

No props.

Also takes the props of `React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>`.

## Rules for using Candor UI

- Components take plain typed data. Never pass model output as HTML or render it as a link; messages are typed blocks.
- A control that can't be used says why: wrap it in `<Locked reason="…">`, don't just disable it.
- Don't show a value you don't have: leave it out (it renders as —) rather than guess. An estimate is labelled as one.
- Nothing is pre-selected in a decision a person makes, and the agent is named from your app's data, never from model output.
- Your app's words go in `LocaleProvider` (fixed strings) and `TermsProvider` (nouns); entity kinds and agent roles in `EntityKindsProvider` and `AgentRolesProvider`.
