Staaarter

Bubble Pills

Every question renders as a fully-rounded pill button in a wrapping row. Clicking a pill marks it active and reveals its answer in a shared panel underneath the row, with only one pill's answer showing at a time.

By Staaarter Team
FAQ
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/bubble-pills.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/faq/faq52.tsx instead.

Usage

The file also exports faq52Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Faq52, faq52Demo } from "@/components/blocks/faq/faq52";

export default function Page() {
  return <Faq52 {...faq52Demo} />;
}

Props

PropTypeDefaultDescription
badgestringnoneOptional small uppercase label above the heading.
headingstringnoneSection heading.
descriptionstringundefinedOptional supporting copy under the heading.
itemsQaItem[]noneQuestion and answer pairs, each rendered as a pill in the flex-wrap row.
classNamestringnoneExtra classes for the outer section element.

Types

type QaItem = { question: string; answer: string };

Behavior notes

  • Real interactivity: clicking a pill sets it as the single active index in state; clicking the already-active pill deselects it and shows the empty-state prompt instead.
  • Only one answer is ever shown at a time, in a shared panel below the pill row, not inline per pill.
  • The first pill is active by default; each pill exposes aria-pressed reflecting its active state.