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 3

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 3
  • Faq 1
  • Faq 2
  • Faq 4

Faq 3

Searchable FAQ section with filter animations

npx shadcn@latest add https://smoothui.dev/r/faq-3.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
163 lines

Code

components/smoothui/faq-3/index.tsx

"use client";

import {
  AccordionHeader,
  AccordionItem,
  AccordionPanel,
  AccordionRoot,
  AccordionTrigger,
} from "@/components/smoothui/accordion";
import Field, { FieldLabel } from "@/components/smoothui/field";
import Input from "@/components/smoothui/input";
import { Search } from "lucide-react";
import { motion, useReducedMotion } from "motion/react";
import { useMemo, useState } from "react";

export interface FaqSearchableProps {
  description?: string;
  faqs?: Array<{
    question: string;
    answer: string;
  }>;
  noResultsText?: string;
  searchPlaceholder?: string;
  title?: string;
}

const defaultFaqs = [
  {
    answer:
      "Getting started is easy! Simply install the package via npm or pnpm, 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 with SmoothUI?",
  },
  {
    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 SmoothUI free to use?",
  },
  {
    answer:
      "SmoothUI requires React 18 or later and works with Next.js 13+. You'll also need Node.js 18+ and a modern browser that supports CSS animations and transforms.",
    question: "What are the system requirements?",
  },
  {
    answer:
      "Absolutely! All animations are fully customizable. You can modify timing, easing, and effects using Motion (Framer Motion) props. We also respect the prefers-reduced-motion setting for accessibility.",
    question: "Can I customize the animations?",
  },
  {
    answer:
      "You can report bugs by opening an issue on our GitHub repository. Please include a detailed description, steps to reproduce, and your environment details. We actively monitor and respond to issues.",
    question: "How do I report bugs or issues?",
  },
  {
    answer:
      "Yes, we offer enterprise support packages that include priority bug fixes, dedicated support channels, custom component development, and SLA guarantees. Contact us for more information.",
    question: "Is there enterprise support available?",
  },
];

export function FaqSearchable({
  title = "Frequently Asked Questions",
  description = "Search through our FAQ to find answers to your questions",
  searchPlaceholder = "Search questions...",
  noResultsText = "No matching questions found. Try a different search term.",
  faqs = defaultFaqs,
}: FaqSearchableProps) {
  const [searchQuery, setSearchQuery] = useState("");
  const shouldReduceMotion = useReducedMotion();

  const filteredFaqs = useMemo(() => {
    if (!searchQuery.trim()) {
      return faqs;
    }
    const query = searchQuery.toLowerCase();
    return faqs.filter(
      (faq) =>
        faq.question.toLowerCase().includes(query) ||
        faq.answer.toLowerCase().includes(query)
    );
  }, [faqs, searchQuery]);

  const springTransition = shouldReduceMotion
    ? { duration: 0 }
    : { bounce: 0.05, duration: 0.25, type: "spring" as const };

  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-12 text-center"
          initial={shouldReduceMotion ? { opacity: 1 } : { opacity: 0, y: 20 }}
          transition={springTransition}
        >
          <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>

        <motion.div
          animate={shouldReduceMotion ? { opacity: 1 } : { opacity: 1, y: 0 }}
          className="relative mb-8"
          initial={shouldReduceMotion ? { opacity: 1 } : { opacity: 0, y: 20 }}
          transition={{
            ...springTransition,
            delay: shouldReduceMotion ? 0 : 0.1,
          }}
        >
          <Search className="pointer-events-none absolute top-1/2 left-4 h-5 w-5 -translate-y-1/2 text-foreground/40" />
          <Field className="gap-0">
            <FieldLabel className="sr-only">
              Search frequently asked questions
            </FieldLabel>
            <Input
              aria-label="Search frequently asked questions"
              className="h-auto rounded-xl border-border bg-background py-4 pr-4 pl-12 text-base text-foreground shadow-none placeholder:text-foreground/40 focus-visible:border-brand focus-visible:ring-2 focus-visible:ring-brand/20"
              onChange={(e) => {
                setSearchQuery(e.target.value);
              }}
              placeholder={searchPlaceholder}
              type="text"
              value={searchQuery}
            />
          </Field>
        </motion.div>

        {filteredFaqs.length === 0 ? (
          <div className="rounded-xl border border-border bg-background/50 py-12 text-center">
            <p className="text-foreground/60">{noResultsText}</p>
          </div>
        ) : (
          <AccordionRoot
            className="space-y-4 divide-y-0 rounded-none border-0"
            key={searchQuery}
          >
            {filteredFaqs.map((faq) => (
              <AccordionItem
                className="overflow-hidden rounded-xl border border-border bg-background transition-colors hover:border-brand"
                key={faq.question}
                value={faq.question}
              >
                <AccordionHeader>
                  <AccordionTrigger className="px-5 py-5 text-base hover:bg-background/50">
                    {faq.question}
                  </AccordionTrigger>
                </AccordionHeader>
                <AccordionPanel className="text-foreground/70">
                  {faq.answer}
                </AccordionPanel>
              </AccordionItem>
            ))}
          </AccordionRoot>
        )}
      </div>
    </section>
  );
}

export default FaqSearchable;

More like this

Faq 2

SmoothUI·Data display

Faq 4

SmoothUI·Data display

Faq 1

SmoothUI·Data display

Poll Widget

Cult UI·Inputs & forms

Features 1

SmoothUI·Cards

Footer 3

SmoothUI·Navigation

Questionnaire

HextaUI·Inputs & forms

Input group

HextaUI·Inputs & forms

Native select

HextaUI·Inputs & forms

Vote Tally

Cult UI·Data display

Cool Mode

Magic UI·Buttons

Command

HextaUI·Overlays

Github Inline Comments

Eldora UI·Other

Animated List

Eldora UI·Data display

Feature Poll

Cult UI·Cards