Skip to content

Commit 1c5200a

Browse files
feat: non-collapsible
1 parent a371541 commit 1c5200a

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

apps/website/src/routes/docs/headless/accordion/index.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ Listen to when a new item is selected by passing a callback function to the `onC
101101

102102
<Showcase name="on-change" />
103103

104+
### Non-collapsible
105+
106+
To disable collapsible behavior, set the `collapsible` prop to `false`.
107+
108+
<Showcase name="collapsible" />
109+
110+
This will prevent the accordion from collapsing when the user clicks on the trigger.
111+
104112
### Disabled items
105113

106114
Items can be disabled by setting the `disabled` prop to true on the `<Accordion.Item />` component.
@@ -140,5 +148,3 @@ You have custom control over how to render items in the Accordion, allowing for
140148
## Example CSS
141149

142150
<CodeSnippet name="accordion.css" />
143-
144-
<Showcase name="collapsible" />

packages/kit-headless/src/components/accordion/accordion-item.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export const HAccordionItem = component$(
103103
bind:open={isOpenSig}
104104
id={itemId}
105105
disabled={context.disabled || props.disabled}
106+
collapsible={context.collapsible}
106107
{...props}
107108
>
108109
<Slot />

packages/kit-headless/src/components/collapsible/collapsible-trigger.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const HCollapsibleTrigger = component$<PropsOf<'button'>>(
77
const contentId = `${context.itemId}-content`;
88

99
const handleClick$ = $(async () => {
10-
if (!context.collapsible) return;
10+
if (context.isOpenSig.value && context.collapsible === false) return;
1111
context.isOpenSig.value = !context.isOpenSig.value;
1212
});
1313

0 commit comments

Comments
 (0)