// Generated by scripts/generate-showcase.mjs. Do not edit directly. page AccordionDetail { layout = "showcase" state playground_size = ctx.url.searchParams.get("pg_size") ?? "default" state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary" state playground_variant = ctx.url.searchParams.get("pg_variant") ?? "default" state playground_class = ctx.url.searchParams.get("pg_class") ?? "showcase-instance showcase-instance--1" state playground_id = ctx.url.searchParams.get("pg_id") ?? "accordion" state playground_items = JSON.parse(ctx.url.searchParams.get("pg_items") ?? "[{\"value\":\"workspace\",\"label\":\"How do I create a workspace?\",\"content\":\"Choose Create workspace, add a name, and invite your team. You can update the details any time in Settings.\"},{\"value\":\"billing\",\"label\":\"Can I change my plan later?\",\"content\":\"Yes. Open Billing to compare plans and choose the one that suits your team.\"},{\"value\":\"security\",\"label\":\"How is my account protected?\",\"content\":\"Enable two-step verification and add a recovery method to keep your account secure.\"}]") state playground_defaultOpen = JSON.parse(ctx.url.searchParams.get("pg_defaultOpen") ?? "[\"workspace\"]") state playground_multiple = (ctx.url.searchParams.get("pg_multiple") ?? "false") === "true" state playground_alwaysOpen = (ctx.url.searchParams.get("pg_alwaysOpen") ?? "false") === "true" state playground_disabled = (ctx.url.searchParams.get("pg_disabled") ?? "false") === "true" state playground_indicator = ctx.url.searchParams.get("pg_indicator") ?? "chevron" state playground_indicatorPosition = ctx.url.searchParams.get("pg_indicatorPosition") ?? "end" state playground_showIndicator = (ctx.url.searchParams.get("pg_showIndicator") ?? "true") === "true" state playground_bordered = (ctx.url.searchParams.get("pg_bordered") ?? "false") === "true" state playground_separated = (ctx.url.searchParams.get("pg_separated") ?? "false") === "true" state playground_flush = (ctx.url.searchParams.get("pg_flush") ?? "false") === "true" state playground_contentItalic = (ctx.url.searchParams.get("pg_contentItalic") ?? "false") === "true" seo { title = "Accordion" description = "Theme-aware, responsive accordion component." } view {
Base component

Accordion

Theme-aware, responsive accordion component.

17 props0 slots3 outputsTheme readyResponsive
Interactive playground

Configure Accordion

Change any prop and inspect the server-rendered component immediately.

Live preview
Component code
page AccordionExample {
  state items = [
  {
    "value": "workspace",
    "label": "How do I create a workspace?",
    "content": "Choose Create workspace, add a name, and invite your team. You can update the details any time in Settings."
  },
  {
    "value": "billing",
    "label": "Can I change my plan later?",
    "content": "Yes. Open Billing to compare plans and choose the one that suits your team."
  },
  {
    "value": "security",
    "label": "How is my account protected?",
    "content": "Enable two-step verification and add a recovery method to keep your account secure."
  }
]
  state defaultOpen = [
  "workspace"
]
  view {
    <Accordion
      items="{items}"
      defaultOpen="{defaultOpen}"
      indicator="chevron"
      indicatorPosition="end"
    />
  }
}
Event outputInteract with the preview to inspect the typed payload.
Component props17 controls
Live examples

Designed for real product surfaces

Compare configurations and resize the browser to check responsive behavior.

Recommended

Plain disclosure rows

Unframed questions with trailing chevrons and aligned answers.

01
Live preview
Component usage.wrn
page AccordionExample {
  state items = [
  {
    "value": "workspace",
    "label": "How do I create a workspace?",
    "content": "Choose Create workspace, add a name, and invite your team. You can update the details any time in Settings."
  },
  {
    "value": "billing",
    "label": "Can I change my plan later?",
    "content": "Yes. Open Billing to compare plans and choose the one that suits your team."
  },
  {
    "value": "security",
    "label": "How is my account protected?",
    "content": "Enable two-step verification and add a recovery method to keep your account secure."
  }
]
  state defaultOpen = [
  "workspace"
]
  view {
    <Accordion
      items="{items}"
      defaultOpen="{defaultOpen}"
      indicator="chevron"
      indicatorPosition="end"
    />
  }
}
Compact

Bordered group

One shared border with leading indicators.

02
Live preview
Component usage.wrn
page AccordionExample {
  state items = [
  {
    "value": "workspace",
    "label": "How do I create a workspace?",
    "content": "Choose Create workspace, add a name, and invite your team. You can update the details any time in Settings."
  },
  {
    "value": "billing",
    "label": "Can I change my plan later?",
    "content": "Yes. Open Billing to compare plans and choose the one that suits your team."
  },
  {
    "value": "security",
    "label": "How is my account protected?",
    "content": "Enable two-step verification and add a recovery method to keep your account secure."
  }
]
  state defaultOpen = [
  "workspace"
]
  view {
    <Accordion
      size="sm"
      variant="secondary"
      items="{items}"
      defaultOpen="{defaultOpen}"
      bordered="true"
    />
  }
}
Advanced

Separate panels

Individually framed rows; multiple answers can stay open.

03
Live preview
Component usage.wrn
page AccordionExample {
  state items = [
  {
    "value": "workspace",
    "label": "How do I create a workspace?",
    "content": "Choose Create workspace, add a name, and invite your team. You can update the details any time in Settings."
  },
  {
    "value": "billing",
    "label": "Can I change my plan later?",
    "content": "Yes. Open Billing to compare plans and choose the one that suits your team."
  },
  {
    "value": "security",
    "label": "How is my account protected?",
    "content": "Enable two-step verification and add a recovery method to keep your account secure."
  }
]
  state defaultOpen = [
  "workspace"
]
  view {
    <Accordion
      size="lg"
      variant="success"
      items="{items}"
      defaultOpen="{defaultOpen}"
      multiple="true"
      indicator="chevron"
      indicatorPosition="end"
      bordered="true"
      separated="true"
    />
  }
}
Component outputs

Receive every typed component output

Use declarative output handlers in .wrn files or register a direct output handler from JavaScript. The canonical API exposes payload and does not require event.detail.

@changeFires when the component's committed value or selection changes.
@openFires after the component opens.
@closeFires after the component closes.
Declarative handlers.wrn
<Accordion
  @change='console.log(payload)'
  @open='console.log(payload)'
  @close='console.log(payload)'
/>
Direct output handlers.js
import { registerOutputHandler } from "@wrnexus/csr/outputs"

const component = document.querySelector("[data-ui-component=\"Accordion\"], [data-component=\"Accordion\"]")

if (component) registerOutputHandler(component, "change", (payload) => {
  console.log("change", payload)
})

if (component) registerOutputHandler(component, "open", (payload) => {
  console.log("open", payload)
})

if (component) registerOutputHandler(component, "close", (payload) => {
  console.log("close", payload)
})
Component API

Props and configuration

All content and behavior shown above is supplied through these props and slots.

PropTypeDefaultRequired
sizestring"default"No
colorstring"primary"No
variantstring"default"No
classstring""No
idstring"accordion"No
itemsunknown[][]No
defaultOpenunknown[][]No
multiplebooleanfalseNo
alwaysOpenbooleanfalseNo
disabledbooleanfalseNo
indicatorstring"plus"No
indicatorPositionstring"start"No
showIndicatorbooleantrueNo
borderedbooleanfalseNo
separatedbooleanfalseNo
flushbooleanfalseNo
contentItalicbooleanfalseNo
} }