import { Accordion } from "./index"; import { DocsPage } from "@shared/stories/DocsTemplate"; import type { Meta, StoryObj } from "@storybook/react"; const meta: Meta = { title: "Components/Accordion", component: Accordion, tags: ["autodocs"], parameters: { layout: "centered", docs: { page: DocsPage, description: { component: "A collapsible accordion component that can expand and collapse content sections with smooth animations.", }, }, }, argTypes: { title: { control: { type: "text" }, description: "Title text displayed in the accordion header", }, defaultOpen: { control: { type: "boolean" }, description: "Whether the accordion is open by default", }, containerClassName: { control: { type: "text" }, description: "Additional CSS classes for the container", }, titleClassName: { control: { type: "text" }, description: "Additional CSS classes for the title", }, className: { control: { type: "text" }, description: "Additional CSS classes for the content area", }, buttonClassName: { control: { type: "text" }, description: "Additional CSS classes for the button", }, }, args: { title: "Accordion Title", defaultOpen: false, children: "This is the accordion content that can be expanded or collapsed.", }, }; export default meta; type Story = StoryObj; // Default accordion export const Default: Story = { args: {}, }; // Accordion with content export const WithContent: Story = { args: { title: "Frequently Asked Questions", children: (

This accordion contains detailed information that can be expanded or collapsed by clicking the header.

You can include any content here, such as text, images, forms, or other components.

), }, }; // Default open accordion export const DefaultOpen: Story = { args: { title: "Open by Default", defaultOpen: true, children: (

This accordion is open by default when the page loads.

Use the defaultOpen prop to control the initial state.

), }, }; // Multiple accordions export const Multiple: Story = { render: () => (

Content for the first accordion section.

Content for the second accordion section. This one is open by default.

Content for the third accordion section.

), parameters: { docs: { description: { story: "Multiple accordions used together to create an FAQ or content section.", }, }, }, }; // Custom styling export const CustomStyling: Story = { args: { title: "Custom Styled Accordion", containerClassName: "border-2 border-border-brand", titleClassName: "text-text-brand font-bold", buttonClassName: "bg-surface-secondary", className: "bg-surface-tertiary", children: (

This accordion has custom styling applied to different parts.

  • Custom container border
  • Custom title styling
  • Custom button background
  • Custom content background
), }, }; // Long content export const LongContent: Story = { args: { title: "Accordion with Long Content", children: (

This accordion demonstrates how it handles longer content sections. The content area will expand to accommodate all the content, and scrolling will be handled naturally within the page.

Subsection 1

Additional details and information can be placed here.

Subsection 2

More content to demonstrate scrolling behavior.

Subsection 3

Even more content to show how the accordion handles extended content areas.

), }, }; // All variants showcase export const AllVariants: Story = { render: () => (

Default State

This accordion starts closed.

Open by Default

This accordion starts open.

Custom Styled

This accordion has custom styling applied.

), parameters: { docs: { description: { story: "Showcase of all accordion variants and states.", }, }, }, };