Skip to content
Every tutorial here is 100% free — and always will be
LSLovableStudent

How do I create tabs or accordions?

Last checked 31 Aug 2026

Short answer

Ask Lovable to use shadcn/ui's Tabs or Accordion component for the specific content you're organising (e.g. FAQ, pricing feature comparison) — these are standard, accessible components already available in the library.

When to use which

  • Tabs: switching between a small number of related views where only one is relevant at a time (e.g. "Monthly / Annual" pricing, "Features / Specs / Reviews").
  • Accordion: a list of items where each can expand independently, and multiple can often be open at once — classic use case is an FAQ section.

Prompt examples

Turn the FAQ section into an accordion — one question per item, collapsed by default, expanding to show the answer when clicked. Allow multiple items open at once.

Add tabs to the pricing section to switch between "Monthly" and "Annual" pricing, defaulting to Monthly.

Both are already in Lovable's component library

shadcn/ui, which Lovable uses by default, includes accessible Tabs and Accordion components with keyboard navigation and ARIA attributes built in — you don't need to ask for a custom-built version, just describe the content and behaviour.

Details worth specifying

  • Which item is expanded/selected by default (often the first, or none for an accordion).
  • Whether an accordion allows one item open at a time or several simultaneously.
  • Any URL/deep-linking requirement, e.g. linking directly to a specific FAQ item from an email — mention this explicitly if you need it, since it's not automatic.

What usually goes wrong

  • Overriding the default component with heavy custom styling can break its built-in keyboard/screen-reader support — if you need a very different look, ask Lovable to keep the underlying Accordion/Tabs primitives and only restyle the visuals.
  • Long accordion answers with no character limit make the page feel unbalanced when expanded — keep answers reasonably concise.
  • Tabs used for content that's actually sequential (a checkout process) rather than parallel — that's better served by steps, not tabs.

Sources

Was this answer helpful?

Related questions

Website made, maintained and hosted by PromptSites.com

PromptSites logo