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
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add faq

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { Faq } from "@/components/ui/faq"; <Faq items={[{ question: "Refunds?", answer: "Up to 48h before doors." }]} />

Source code

faq.tsx + 1 helper

Zero 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 />
PropTypeDescription
itemsFaqItem[]Structured list of items rendered by the component. (Default: [])
defaultOpennumberInitial open state when uncontrolled. (Default: 0)
classNamestringOptional Tailwind or custom CSS classes merged with component styles.