> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Collapsible

One section whose content shows and hides when its trigger is tapped.


## Installation

```bash
npx @blotch/dolan add collapsible
```

```typescript
import {
  UiCollapsible,
  UiCollapsibleContent,
  UiCollapsibleTrigger,
} from '../components/ui/collapsible';
```

## Usage

```typescript title="src/app/app.ts"
import { Component, signal } from '@angular/core';
import { LYNX_ELEMENTS } from '@blotch/angular-lynx';
import {
  UiCollapsible,
  UiCollapsibleContent,
  UiCollapsibleTrigger,
} from '../components/ui/collapsible';

@Component({
  selector: 'app-root',
  imports: [
    LYNX_ELEMENTS,
    UiCollapsible,
    UiCollapsibleTrigger,
    UiCollapsibleContent,
  ],
  template: `
    <ui-collapsible [(open)]="open" class="rounded-lg border border-border">
      <ui-collapsible-trigger class="justify-between p-4">
        <text class="text-sm font-medium text-foreground">
          3 tagged versions
        </text>
        <text class="text-xs text-muted-foreground">
          {{ open() ? 'Hide' : 'Show' }}
        </text>
      </ui-collapsible-trigger>
      <ui-collapsible-content>
        <view class="px-4 pb-4">
          <text class="text-sm text-foreground">v1.0.0, v1.1.0, v2.0.0</text>
        </view>
      </ui-collapsible-content>
    </ui-collapsible>
  `,
})
export class App {
  protected readonly open = signal(false);
}
```

- `[(open)]` keeps your signal and the collapsible in step. Leave it out if you don't need the state.
- The trigger is a row (`flex-row items-center`) and doesn't wrap its content, so put your own `<text>` elements inside.
- Content shows only while open. It slides and fades in as it opens.

### Open from code

```angular-html
<ui-collapsible [(open)]="open">…</ui-collapsible>
```

Set the bound signal, for example `this.open.set(true)`, and the content opens. `UiCollapsible` also has a public `toggle()` method, which does nothing while disabled.

### Disabled

```angular-html
<ui-collapsible disabled>…</ui-collapsible>
```

The trigger dims and ignores taps. Setting `open` from code still works.

## API

### UiCollapsible

| Input      | Type      | Default | Description                                     |
| ---------- | --------- | ------- | ----------------------------------------------- |
| `open`     | `boolean` | `false` | Whether the content shows. Supports `[(open)]`. |
| `disabled` | `boolean` | `false` | Dims the trigger and ignores taps.              |
| `class`    | `string`  | `''`    | Extra Tailwind classes for the container.       |

| Output       | Type      | Description                                     |
| ------------ | --------- | ----------------------------------------------- |
| `openChange` | `boolean` | Emits the new state when the trigger is tapped. |

All sub-components (`UiCollapsibleTrigger`, `UiCollapsibleContent`) accept `class`.

## Related

- [Accordion](/dolan/accordion.md): several sections that open one at a time
- [Signals and change detection](/guide/concepts/signals.md)
