Components
Horizontal Accordion
Panels side by side that widen when chosen.
Still water, early light.
Above the clouds.
Warm sand, cold nights.
Moss, ferns and quiet.
<HorizontalAccordion panels={panels} />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/horizontal-accordion.jsonimport { 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
| Prop | Type | Default | Description |
|---|---|---|---|
panels | { title, content, background? }[] | The panels. background takes any CSS background. | |
defaultIndex | number | 0 | Panel open at the start. |
height | number | 320 | Height in pixels. |
className | string | Classes for the wrapper. |
With reduced motion, panels change width without animating.