UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

SmoothUI/Faq 2

Data display
1 of 4
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

4 versions·1 library

  • Faq 2
  • Faq 1
  • Faq 3
  • Faq 4

Faq 2

FAQ accordion block with expandable questions

npx shadcn@latest add https://smoothui.dev/r/faq-2.json
Open in v0 Docs Repo
Library
SmoothUI
License
MIT
Stack
React · Tailwind CSS · animated · base-ui
Packages
@base-ui/reactlucide-reactmotion
Also adds
index
Size
150 lines

Code

components/smoothui/faq-2/index.tsx

"use client";

import {
  AccordionHeader,
  AccordionItem,
  AccordionPanel,
  AccordionRoot,
  AccordionTrigger,
} from "@/components/smoothui/accordion";
import { motion, useReducedMotion } from "motion/react";

const ANIMATION_DURATION = 0.6;
const STAGGER_DELAY = 0.1;
const INITIAL_Y_OFFSET = 20;
const HOVER_SCALE = 1.01;
const TAP_SCALE = 0.99;

interface FaqsAccordionProps {
  description?: string;
  faqs?: Array<{
    question: string;
    answer: string;
  }>;
  title?: string;
}

export function FaqsAccordion({
  title = "Frequently Asked Questions",
  description = "Find answers to common questions about our product and services",
  faqs = [
    {
      answer:
        "SmoothUI is a modern UI component library that provides beautiful, animated components for building stunning user interfaces. It includes pre-built components with smooth animations and customizable themes.",
      question: "What is SmoothUI?",
    },
    {
      answer:
        "Getting started is easy! Simply install the package via npm or yarn, import the components you need, and start building. We provide comprehensive documentation and examples to help you get up and running quickly.",
      question: "How do I get started?",
    },
    {
      answer:
        "Yes! SmoothUI is completely free and open source. You can use it in both personal and commercial projects without any restrictions. We believe in making beautiful UI components accessible to everyone.",
      question: "Is it free to use?",
    },
    {
      answer:
        "Absolutely! All components are fully customizable. You can modify colors, spacing, animations, and more using CSS variables or by extending the component classes. We also provide a theming system for easy customization.",
      question: "Can I customize the components?",
    },
    {
      answer:
        "Currently, SmoothUI supports React and Next.js. We're working on expanding support to other popular frameworks like Vue, Svelte, and Angular in the coming months.",
      question: "What frameworks are supported?",
    },
    {
      answer:
        "We release updates regularly, typically every 2-3 weeks. This includes new components, bug fixes, performance improvements, and new features. You can follow our changelog to stay updated on the latest releases.",
      question: "How often do you release updates?",
    },
  ],
}: FaqsAccordionProps) {
  const shouldReduceMotion = useReducedMotion();
  const firstQuestion = faqs[0]?.question;

  return (
    <section className="py-20">
      <div className="mx-auto max-w-4xl px-6">
        <motion.div
          animate={shouldReduceMotion ? { opacity: 1 } : { opacity: 1, y: 0 }}
          className="mb-16 text-center"
          initial={
            shouldReduceMotion
              ? { opacity: 1 }
              : { opacity: 0, y: INITIAL_Y_OFFSET }
          }
          transition={
            shouldReduceMotion
              ? { duration: 0 }
              : { duration: ANIMATION_DURATION }
          }
          viewport={{ once: true }}
          whileInView={
            shouldReduceMotion ? { opacity: 1 } : { opacity: 1, y: 0 }
          }
        >
          <h2 className="mb-4 font-bold text-3xl text-foreground lg:text-4xl">
            {title}
          </h2>
          <p className="mx-auto max-w-2xl text-foreground/70 text-lg">
            {description}
          </p>
        </motion.div>

        <AccordionRoot
          className="space-y-4 divide-y-0 overflow-visible rounded-none border-0"
          defaultValue={firstQuestion}
        >
          {faqs.map((faq, index) => (
            <motion.div
              animate={
                shouldReduceMotion ? { opacity: 1 } : { opacity: 1, y: 0 }
              }
              initial={
                shouldReduceMotion
                  ? { opacity: 1 }
                  : { opacity: 0, y: INITIAL_Y_OFFSET }
              }
              key={faq.question}
              tabIndex={-1}
              transition={
                shouldReduceMotion
                  ? { duration: 0 }
                  : {
                      delay: index * STAGGER_DELAY,
                      duration: ANIMATION_DURATION,
                    }
              }
              viewport={{ once: true }}
              whileHover={shouldReduceMotion ? {} : { scale: HOVER_SCALE }}
              whileInView={
                shouldReduceMotion ? { opacity: 1 } : { opacity: 1, y: 0 }
              }
              whileTap={shouldReduceMotion ? {} : { scale: TAP_SCALE }}
            >
              <AccordionItem
                className="overflow-hidden rounded-2xl border border-border bg-background transition-all hover:border-brand hover:shadow-lg"
                value={faq.question}
              >
                <AccordionHeader>
                  <AccordionTrigger className="p-6 text-left font-semibold text-foreground text-lg hover:bg-background/50">
                    {faq.question}
                  </AccordionTrigger>
                </AccordionHeader>
                <AccordionPanel className="text-base text-foreground/70">
                  <p className="-mx-4 -mb-4 px-6 pb-6 text-base leading-relaxed">
                    {faq.answer}
                  </p>
                </AccordionPanel>
              </AccordionItem>
            </motion.div>
          ))}
        </AccordionRoot>
      </div>
    </section>
  );
}

export default FaqsAccordion;

More like this

Testimonials 3

SmoothUI·Cards

Loading Carousel

Cult UI·Feedback & loaders

Faq 3

SmoothUI·Data display

Faq 1

SmoothUI·Data display

Footer 3

SmoothUI·Navigation

Minimal Card

Cult UI·Cards

Github Inline Comments

Eldora UI·Other

Scroll Index

Kokonut UI·Text effects

Features 1

SmoothUI·Cards

Ai Citations

Kokonut UI·Other

Poll Widget

Cult UI·Inputs & forms

Safari

Magic UI·Media & 3D

Faq 4

SmoothUI·Data display

Edge Blur

Cult UI·Cursor & effects

Ai Branch

SmoothUI·Other