Accordion
Expandable accordion component with single-item expansion
Quick Preview
Next.js is a React framework for building full-stack web applications. It provides features like server-side rendering, static site generation, and API routes.
You can start by installing Next.js with 'npx create-next-app@latest' and then follow the official documentation to build your first application.
Yes, Next.js is completely free and open-source. You can use it for personal and commercial projects without any licensing fees.
Installation
// Copy the Accordion component fromsrc/components/ui/Accordion.tsx// Install dependenciesnpm install lucide-react
Usage
import { Accordion } from '@/components/ui/Accordion'const faqItems = [{question: "What is Next.js?",answer: "Next.js is a React framework...",category: "general"},// ... more items]export default function MyComponent() {return <Accordion items={faqItems} />}
Examples
Basic Accordion
Simple accordion with FAQ items
Next.js is a React framework for building full-stack web applications. It provides features like server-side rendering, static site generation, and API routes.
You can start by installing Next.js with 'npx create-next-app@latest' and then follow the official documentation to build your first application.
With Category Filter
Filter items by category
Next.js is a React framework for building full-stack web applications. It provides features like server-side rendering, static site generation, and API routes.
You can start by installing Next.js with 'npx create-next-app@latest' and then follow the official documentation to build your first application.
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items* | FAQItem[] | - | Array of accordion items with question and answer |
category | "general" | "account" | - | Optional category filter |
FAQItem Type
interface FAQItem {question: stringanswer: stringcategory: "general" | "account"}
Features
- โSingle-item expansion (radio-style)
- โAnimated chevron rotation
- โOptional category filtering
- โFirst item open by default
- โClient-side interactivity