@@ -5,10 +5,27 @@ const meta: Meta = {
55 title : 'Components/Accordion' ,
66 component : 'wu-accordion' ,
77 tags : [ 'autodocs' ] ,
8+ argTypes : {
9+ single : {
10+ control : 'boolean' ,
11+ description : 'Restrict so only one item can be open at a time.' ,
12+ table : {
13+ type : { summary : 'boolean' } ,
14+ defaultValue : { summary : 'false' } ,
15+ } ,
16+ } ,
17+ } ,
18+ args : {
19+ single : false ,
20+ } ,
821 parameters : {
922 docs : {
1023 description : {
11- component : 'Collapsible disclosure panels. Set `multiple` to allow more than one panel open at a time. Compose with `<wu-accordion-item>` elements.' ,
24+ component :
25+ 'Collapsible disclosure panels. Add the `single` attribute to restrict ' +
26+ 'to one open item at a time. Compose with `<wu-accordion-item>` elements. ' +
27+ 'Each item supports a `summary` slot (the clickable header) and a ' +
28+ 'default slot (the revealed body content).' ,
1229 } ,
1330 } ,
1431 } ,
@@ -17,29 +34,35 @@ const meta: Meta = {
1734export default meta ;
1835type Story = StoryObj ;
1936
37+ /** Default accordion — multiple items can be open simultaneously. */
2038export const Default : Story = {
21- render : ( ) => html `
22- < wu-accordion style ="max-width:560px ">
39+ args : { single : false } ,
40+ render : ( args ) => html `
41+ < wu-accordion ?single =${ args [ 'single' ] } style ="max-width:560px">
2342 < wu-accordion-item >
2443 < span slot ="summary "> What is WeldUI?</ span >
25- WeldUI is a framework-agnostic component library built with Lit Web Components.
26- It works in any framework — React, Vue, Angular, Svelte, or plain HTML.
44+ WeldUI is a framework-agnostic component library built on Lit Web Components.
45+ It works in React, Vue, Angular, Svelte, or plain HTML with zero dependencies .
2746 </ wu-accordion-item >
2847 < wu-accordion-item >
2948 < span slot ="summary "> How do I install it?</ span >
3049 Run < code > pnpm add @weldui/core</ code > and import the components you need.
50+ Each component auto-registers its custom element on import.
3151 </ wu-accordion-item >
3252 < wu-accordion-item >
3353 < span slot ="summary "> Is it accessible?</ span >
34- Yes — all components target WCAG 2.1 AA compliance with full keyboard navigation.
54+ Yes — all components target WCAG 2.1 AA with full keyboard navigation,
55+ ARIA attributes, and focus management.
3556 </ wu-accordion-item >
3657 </ wu-accordion >
3758 ` ,
3859} ;
3960
61+ /** With `single` — opening one item automatically closes the others. */
4062export const SingleOpen : Story = {
41- render : ( ) => html `
42- < wu-accordion single style ="max-width:560px ">
63+ args : { single : true } ,
64+ render : ( args ) => html `
65+ < wu-accordion ?single =${ args [ 'single' ] } style ="max-width:560px">
4366 < wu-accordion-item open >
4467 < span slot ="summary "> First item (open by default)</ span >
4568 This item is open by default. Opening another will close this one.
@@ -55,3 +78,61 @@ export const SingleOpen: Story = {
5578 </ wu-accordion >
5679 ` ,
5780} ;
81+
82+ /** Items can be individually disabled — they cannot be toggled by the user. */
83+ export const DisabledItems : Story = {
84+ render : ( ) => html `
85+ < wu-accordion style ="max-width:560px ">
86+ < wu-accordion-item >
87+ < span slot ="summary "> Active item</ span >
88+ This item is active and can be expanded freely.
89+ </ wu-accordion-item >
90+ < wu-accordion-item disabled >
91+ < span slot ="summary "> Disabled item (cannot expand)</ span >
92+ This content would never be revealed — the item is locked.
93+ </ wu-accordion-item >
94+ < wu-accordion-item >
95+ < span slot ="summary "> Another active item</ span >
96+ This item is also fully interactive.
97+ </ wu-accordion-item >
98+ </ wu-accordion >
99+ ` ,
100+ } ;
101+
102+ /** Body slots accept any HTML — code blocks, lists, inline elements. */
103+ export const RichContent : Story = {
104+ render : ( ) => html `
105+ < wu-accordion style ="max-width:560px ">
106+ < wu-accordion-item open >
107+ < span slot ="summary "> Getting started</ span >
108+ < p style ="margin:0 0 var(--wu-space-3) "> Install WeldUI with your package manager:</ p >
109+ < pre style ="
110+ margin:0;
111+ background:var(--wu-color-surface);
112+ padding:var(--wu-space-3) var(--wu-space-4);
113+ border-radius:var(--wu-radius-md);
114+ font-family:var(--wu-font-mono);
115+ font-size:var(--wu-text-xs);
116+ color:var(--wu-color-text);
117+ overflow-x:auto;
118+ "> pnpm add @weldui/core</ pre >
119+ </ wu-accordion-item >
120+ < wu-accordion-item >
121+ < span slot ="summary "> Supported frameworks</ span >
122+ < ul style ="margin:0;padding-left:var(--wu-space-5);display:flex;flex-direction:column;gap:var(--wu-space-2) ">
123+ < li > React — < code style ="font-family:var(--wu-font-mono);font-size:var(--wu-text-xs) "> @weldui/react</ code > </ li >
124+ < li > Vue 3 — < code style ="font-family:var(--wu-font-mono);font-size:var(--wu-text-xs) "> @weldui/vue</ code > </ li >
125+ < li > Angular — < code style ="font-family:var(--wu-font-mono);font-size:var(--wu-text-xs) "> @weldui/angular</ code > </ li >
126+ < li > Svelte — native Web Components, no wrapper needed</ li >
127+ < li > Plain HTML / JS — zero dependencies</ li >
128+ </ ul >
129+ </ wu-accordion-item >
130+ < wu-accordion-item >
131+ < span slot ="summary "> Browser support</ span >
132+ All evergreen browsers — Chrome, Firefox, Safari, and Edge (latest 2 versions).
133+ Web Components (Custom Elements v1 + Shadow DOM v1) are required.
134+ </ wu-accordion-item >
135+ </ wu-accordion >
136+ ` ,
137+ } ;
138+
0 commit comments