Skip to content

Commit 9e91cd3

Browse files
committed
refactor: update accordion demo
1 parent f01249c commit 9e91cd3

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

apps/showcase/demo/styled/accordion/basic-demo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function BasicDemo() {
1414
<Accordion.Content>
1515
<p className="text-sm">
1616
This service helps you manage your projects more efficiently by offering real-time collaboration, task tracking, and powerful
17-
analytics. Whether you’re working solo or in a team, it’s built to scale with your needs.
17+
analytics.
1818
</p>
1919
</Accordion.Content>
2020
</Accordion.Panel>

apps/showcase/demo/styled/accordion/with-radiobutton-demo.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use client';
2-
import type { useAccordionChangeEvent } from '@primereact/types/shared/accordion';
2+
import type { AccordionRootValueChangeEvent } from '@primereact/types/shared/accordion';
33
import type { RadioButtonGroupValueChangeEvent } from '@primereact/types/shared/radiobuttongroup';
44
import { Accordion } from '@primereact/ui/accordion';
55
import { Button } from '@primereact/ui/button';
@@ -41,22 +41,26 @@ export default function WithRadioButtonDemo() {
4141
>
4242
<Accordion.Root
4343
value={selected}
44-
onChange={(e: useAccordionChangeEvent) => setSelected(e.value as string)}
44+
onValueChange={(e: AccordionRootValueChangeEvent) => setSelected(e.value as string)}
4545
className="w-full border border-surface-200 dark:border-surface-700 rounded-md divide-y divide-surface-200 dark:divide-surface-700"
4646
>
4747
{items.map((item) => (
48-
<Accordion.Panel key={item.value} value={item.value} className="last:border-none transition-all ease-out">
48+
<Accordion.Panel key={item.value} value={item.value} className="last:border-none">
4949
<Accordion.Header
5050
onClick={() => setSelected(item.value)}
51-
className="flex items-center justify-between bg-transparent py-3"
51+
className="flex items-center justify-between bg-transparent px-4 py-3"
5252
>
5353
<span className="flex items-center gap-4">
54-
<RadioButton.Root inputId={`radio-${item.value}`} name="price" value={item.value} />
54+
<RadioButton.Root inputId={`radio-${item.value}`} name="price" value={item.value}>
55+
<RadioButton.Box>
56+
<RadioButton.Indicator match="checked" />
57+
</RadioButton.Box>
58+
</RadioButton.Root>
5559
<span className="font-semibold text-base">{item.label}</span>
5660
</span>
5761
<span className="font-semibold text-base">{item.price}</span>
5862
</Accordion.Header>
59-
<Accordion.Content className="bg-transparent px-4 pb-3.5 leading-6 pl-12.5">
63+
<Accordion.Content className="bg-transparent px-4 leading-6 pl-12.5">
6064
<p className="text-sm">{item.description}</p>
6165
</Accordion.Content>
6266
</Accordion.Panel>

0 commit comments

Comments
 (0)