FAQ List

This is a FAQ List component.

Installation

1. Dependencies

npm install clsx tailwind-merge framer-motion react-icons

2. Paste inside @/lib/utils.ts

import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: Parameters<typeof clsx>) {
  return twMerge(clsx(...inputs));
}

3. Copy FAQ List Code

Loading...

Copy FAQ List Code

FAQList Props

NameTypeRequiredDefaultDescription
childrenReact.ReactElement[]YesundefinedThe FAQItem components to display.

FAQItem Props

NameTypeRequiredDefaultDescription
questionstringYesundefinedThe question to display.
answerstringYesundefinedThe answer to display.
indexnumberNoundefinedThe index of the item in the list.
isOpenbooleanNofalseWhether the item is open or closed.
onToggle() => voidNoundefinedFunction to toggle the item's open state.
classNamestringNoundefinedAdditional class names for styling.