Staaarter

Left Border Accent

A single-open accordion where the active question gets a primary-colored left border and matching text color, while closed items sit flush with a transparent border, giving a subtle but clear indicator of what's expanded.

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/left-border-accent.json

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

Usage

The file also exports faq38Demo, 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 { Faq38, faq38Demo } from "@/components/blocks/faq/faq38";

export default function Page() {
  return <Faq38 {...faq38Demo} />;
}

Props

PropTypeDefaultDescription
badgestringnoneSmall label shown above the heading.
headingstringnoneSection heading.
descriptionstringnoneSupporting copy under the heading.
itemsAccentFaqItem[]noneList of questions and answers.
classNamestringnoneExtra classes for the outer section element.

Types

interface AccentFaqItem {
  question: string;
  answer: string;
}

Behavior notes

  • "use client" because a single question is expanded at a time in local state, toggled by a real aria-expanded button.
  • The open item gets border-l-2 border-primary and text-primary on its question; closed items get border-l-2 border-transparent so layout never shifts as items open and close.
  • The answer itself toggles in and out of the DOM on open/close rather than height-animating, keeping the border/color change as the primary visual cue per the brief.