Home Components Collapsible
React Collapsible Components
9 free React collapsibles built with Tailwind CSS and shadcn/ui conventions. Copy the code or install with the shadcn CLI. Great for show more sections, file trees, and expandable rows.
Collapsible 1 : Shared notes list showing one file, with a chevron button that reveals the remaining files.Collapsible 2 : Nested file tree where each folder expands and collapses with a rotating chevron and open folder icon.Collapsible 3 : Team progress list showing two members, with a Show more button that reveals the rest.Collapsible 4 : List of user rows that each expand to show a bio, follower and project counts and a Follow button.Collapsible 5 : Product filter panel with collapsible price, rating, brand and battery sections of inputs and checkboxes.Collapsible 6 : FAQ list with Show answer and Hide answer text toggles under each question, the first open by default.Collapsible 7 : Help card with a question and a Show button that reveals the answer and a full-width photo.Collapsible 8 : Dropdown menu with collapsible Settings and Workspace sections nested inside it and a Log out item.Collapsible 9 : Checkout panel with collapsible delivery address fields using floating labels and priced delivery options.
About React Collapsible Components A React collapsible is a single region that shows or hides content when a trigger is clicked, like a show more section. Watermelon UI collapsibles are built on the Radix UI Collapsible primitive with Tailwind CSS, so the trigger gets aria-expanded and the open state can be controlled or left uncontrolled. Add one with the shadcn CLI, then put your trigger and content inside it.
When to use it Show more sections on long descriptions or reviews. Advanced options hidden under a simple form. Expandable groups in a sidebar navigation. When to use something else Use Tabs when the user switches between several panels instead of opening one. Use Popover when the content should float over the page rather than push it down. Use Sheet when the hidden content is large enough to need its own panel. Frequently asked questions What is the difference between collapsible and accordion? A collapsible controls one region, while an accordion manages a list of sections and can limit how many are open. Use an accordion when you have several related items.
How do I make a shadcn collapsible open by default? Pass defaultOpen to the Collapsible root. To control it, pass open and onOpenChange instead.
How do I animate the collapsible? Animate CollapsibleContent based on its data-state attribute, using the --radix-collapsible-content-height CSS variable for the height. That variable holds the measured content height.
How do I rotate the chevron when it opens? Style the icon with a data-state selector on the trigger, for example a group class and group-data-[state=open]:rotate-180. The trigger gets data-state="open" or "closed".
How to use React Collapsible Components Start from a React project with Tailwind CSS and shadcn/ui set up. Next.js, Vite, Remix, and Astro all work. Run npx shadcn@latest add https://registry.watermelon.sh/r/collapsible-1.json to add the source files to your project. Import it where you need it, then edit the Tailwind classes and design tokens to match your product. Dependencies installed with it: lucide-react.
The code is yours: it lives in your repository, so there is no runtime package to keep updated. Watermelon UI is free and open source under the MIT license.
More: Free React components , UI library alternatives , guides .