import { html, nothing } from "lit"; import { unsafeHTML } from "lit/directives/unsafe-html.js"; export interface AccordionProps { bordered: boolean; toggleValue?: string; allowMultiple: boolean; } const items = [ { title: "First", expanded: true, content: `

Accordion content for the first item.

`, }, { title: "Second", expanded: false, content: `

Accordion content for the second item.

`, }, { title: "Third", expanded: false, content: `

Accordion content for the third item.

`, }, ]; export const Accordion = ({ bordered, toggleValue, allowMultiple }: AccordionProps) => { const classes = ["usa-accordion", bordered && "usa-accordion--bordered"] .filter(Boolean) .join(" "); // Unique per call to Accordion needed so the `name` attribute grouping // `
` elements doesn't collide across instances inside Storybook. const instanceId = toggleValue ?? `acc-${crypto.randomUUID()}`; return html`
${items.map( (item) => html`

${item.title}

${unsafeHTML(item.content)}
`, )}
`; };