# Read more

> Truncated paragraph reveals the rest; trigger label swaps to Show less.

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

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

## Install

```bash
npx shadcn@latest add https://ui.flexnative.com/r/collapsible-04.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`

## Files

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

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

export function Collapsible04() {
  return (
    <Collapsible className="w-full max-w-md space-y-2">
      <p className="text-sm leading-relaxed">
        Collapsible shows and hides a section of content behind an accessible
        trigger. It ships unstyled, so you own the markup, spacing, and
        animation entirely.
      </p>
      <CollapsibleContent>
        <p className="text-sm leading-relaxed">
          Under the hood it tracks the open state and exposes the content height
          as a CSS variable, so you can animate from zero to the natural height
          without measuring anything in JavaScript. Pair it with a chevron and a
          label swap for a polished read-more control.
        </p>
      </CollapsibleContent>
      <CollapsibleTrigger className="group text-primary inline-flex items-center gap-1 text-sm font-medium">
        <span className="group-data-panel-open:hidden">Read more</span>
        <span className="hidden group-data-panel-open:inline">Show less</span>
        <ChevronDownIcon className="size-4 transition-transform group-data-panel-open:rotate-180" />
      </CollapsibleTrigger>
    </Collapsible>
  )
}
```
