Skip to Content
zjkm-ui
Components

Horizontal Accordion

Panels side by side that widen when chosen.

Still water, early light.
Props
320px
<HorizontalAccordion panels={panels} />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/horizontal-accordion.json
import { HorizontalAccordion } from "@/components/horizontal-accordion"

Using JavaScript? Set tsx: false in components.json and the CLI converts it.

New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.

Usage

Panels side by side, like a gallery. The chosen panel widens to show its content while the others shrink to a narrow strip with a vertical title. Each panel's header is a real button.

import { HorizontalAccordion } from "@/components/horizontal-accordion";

const panels = [
  { title: "Lakes", content: "Still water, early light.", background: "url(/lakes.jpg) center / cover" },
  { title: "Peaks", content: "Above the clouds.", background: "url(/peaks.jpg) center / cover" },
];

export function Destinations() {
  return <HorizontalAccordion panels={panels} />;
}

Props

PropTypeDefaultDescription
panels{ title, content, background? }[]The panels. background takes any CSS background.
defaultIndexnumber0Panel open at the start.
heightnumber320Height in pixels.
classNamestringClasses for the wrapper.

With reduced motion, panels change width without animating.

On this page