# Basic

> Canonical starred-repos toggle with a chevron trigger.

A shadcn/ui block from the [@flx](https://ui.flexnative.com) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/flx/collapsible-01).

- Page, with a live preview: https://shadcn.exchange/r/flx/collapsible-01
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/flx/collapsible-01-light-2c3c6e0c97d09cf4.png
- Registry item: https://ui.flexnative.com/r/collapsible-01.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.flexnative.com/r/collapsible-01.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `collapsible`, `button`

## Files

### `registry/patterns/collapsible/collapsible-01.tsx`

```tsx
import { Button } from '@/components/ui/button'
import {
  Collapsible,
  CollapsibleContent,
  CollapsibleTrigger,
} from '@/components/ui/collapsible'
import { ChevronsUpDownIcon } from 'lucide-react'

const repos = ['@radix-ui/primitives', '@radix-ui/colors', '@stitches/react']

export function Collapsible01() {
  return (
    <Collapsible defaultOpen className="w-full max-w-sm space-y-2">
      <div className="flex items-center justify-between gap-4 px-1">
        <h4 className="text-sm font-semibold">
          @peduarte starred 3 repositories
        </h4>
        <CollapsibleTrigger
          render={
            <Button variant="ghost" size="icon-sm" aria-label="Toggle repos">
              <ChevronsUpDownIcon />
            </Button>
          }
        />
      </div>
      <div className="rounded-md border px-4 py-2 font-mono text-sm">
        {repos[0]}
      </div>
      <CollapsibleContent className="space-y-2">
        {repos.slice(1).map((repo) => (
          <div
            key={repo}
            className="rounded-md border px-4 py-2 font-mono text-sm"
          >
            {repo}
          </div>
        ))}
      </CollapsibleContent>
    </Collapsible>
  )
}
```
