Componentdata0.76 KB gzipZero dependencies
Faq
Self-contained accordion Q&A with one-open behavior, grid-rows height reveal and rotating plus icon.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add faqOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { Faq } from "@/components/ui/faq"; <Faq items={[{ question: "Refunds?", answer: "Up to 48h before doors." }]} />Source code
faq.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxfaq.tsx65 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface FaqItem { question: string; answer: string;} export interface FaqProps extends React.HTMLAttributes<HTMLElement> { items: FaqItem[]; defaultOpen?: number; className?: string;} export function Faq({ items = [], defaultOpen = 0, className, ...props }: FaqProps) { const [openIndex, setOpenIndex] = React.useState<number | null>(defaultOpen);Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { Faq } from "@/components/ui/faq"; <Faq />| Prop | Type | Description |
|---|---|---|
| items | FaqItem[] | Structured list of items rendered by the component. (Default: []) |
| defaultOpen | number | Initial open state when uncontrolled. (Default: 0) |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |