- Prop
items- Type
AccordionItem<string>[]- Default
- —
- Requirement
- required
Docs Components Data Display
Accordion
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
const accordionFixture = { id: "accordion", type: "single", defaultValue: ["deploy"], items: [ { value: "deploy", trigger: "Deploy policy", content: "Production deploys require a green verification run." }, { value: "rollback", trigger: "Rollback policy", content: "Roll back to the last verified release.", disabled: true }, ],} satisfies { id: string; type: "single" | "multiple"; defaultValue: string[]; items: Array<{ value: string; trigger: string; content: string; disabled?: boolean }>;}; import { Accordion } from "@grassroot/ui-react"; export default function AccordionDemo() { return ( <div> <Accordion {...accordionFixture} /> </div> );}- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script setup lang="ts">import { Accordion } from "@grassroot/ui-vue";const accordionFixture = { id: "accordion", type: "single", defaultValue: ["deploy"], items: [ { value: "deploy", trigger: "Deploy policy", content: "Production deploys require a green verification run." }, { value: "rollback", trigger: "Rollback policy", content: "Roll back to the last verified release.", disabled: true }, ],} satisfies { id: string; type: "single" | "multiple"; defaultValue: string[]; items: Array<{ value: string; trigger: string; content: string; disabled?: boolean }>;}; </script> <template> <div> <Accordion :items="accordionFixture.items" :type="accordionFixture.type" :default-value="accordionFixture.defaultValue" /> </div></template>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Component, signal } from "@angular/core";import { GrassrootAccordion } from "@grassroot/ui-angular";const accordionFixture = { id: "accordion", type: "single", defaultValue: ["deploy"], items: [ { value: "deploy", trigger: "Deploy policy", content: "Production deploys require a green verification run." }, { value: "rollback", trigger: "Rollback policy", content: "Roll back to the last verified release.", disabled: true }, ],} satisfies { id: string; type: "single" | "multiple"; defaultValue: string[]; items: Array<{ value: string; trigger: string; content: string; disabled?: boolean }>;}; @Component({ selector: "app-accordion-demo", standalone: true, imports: [GrassrootAccordion], host: { style: "display: block; width: 600px; max-width: 100%;" }, template: `<grassroot-accordion [items]="items" [type]="fixture.type" [(value)]="open" />`,})export class AccordionDemoComponent { protected readonly fixture = accordionFixture; protected readonly items = [...accordionFixture.items]; protected readonly open = signal([...accordionFixture.defaultValue]);} export default AccordionDemoComponent;- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script lang="ts"> import { Accordion } from "@grassroot/ui-svelte"; const accordionFixture = { id: "accordion", type: "single", defaultValue: ["deploy"], items: [ { value: "deploy", trigger: "Deploy policy", content: "Production deploys require a green verification run." }, { value: "rollback", trigger: "Rollback policy", content: "Roll back to the last verified release.", disabled: true }, ], } satisfies { id: string; type: "single" | "multiple"; defaultValue: string[]; items: Array<{ value: string; trigger: string; content: string; disabled?: boolean }>; }; </script> <div> <Accordion items={accordionFixture.items} type={accordionFixture.type} defaultValue={accordionFixture.defaultValue} /></div>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** @jsxImportSource solid-js */import { Accordion } from "@grassroot/ui-solid";const accordionFixture = { id: "accordion", type: "single", defaultValue: ["deploy"], items: [ { value: "deploy", trigger: "Deploy policy", content: "Production deploys require a green verification run." }, { value: "rollback", trigger: "Rollback policy", content: "Roll back to the last verified release.", disabled: true }, ],} satisfies { id: string; type: "single" | "multiple"; defaultValue: string[]; items: Array<{ value: string; trigger: string; content: string; disabled?: boolean }>;}; import type { JSX } from "solid-js"; export default function AccordionDemo(): JSX.Element { return ( <div> <Accordion items={accordionFixture.items} type={accordionFixture.type} defaultValue={accordionFixture.defaultValue} /> </div> );}Installation
API Reference
Import
import { Accordion } from "@grassroot/ui-react";
Props
Prop
Type
Default
Requirement
itemsAccordionItem<string>[]—
required
type"single" | "multiple" | undefined"single"optional
valuestring[] | undefined—
optional
defaultValuestring[] | undefined—
optional
onValueChange((value: string[]) => void) | undefined—
optional
classNamestring | undefined—
optional
idstring | undefined—
optional
- Prop
type- Type
"single" | "multiple" | undefined- Default
"single"- Requirement
- optional
- Prop
value- Type
string[] | undefined- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string[] | undefined- Default
- —
- Requirement
- optional
- Prop
onValueChange- Type
((value: string[]) => void) | undefined- Default
- —
- Requirement
- optional
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
id- Type
string | undefined- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onValueChange | ((value: string[]) => void) | undefined |
Import
import { Accordion } from "@grassroot/ui-vue";
Props
Prop
Type
Default
Requirement
itemsAccordionItem<string>[]—
required
type"single" | "multiple" | undefined"single"optional
modelValuestring[] | undefined—
optional
defaultValuestring[] | undefined—
optional
idstring | undefined—
optional
- Prop
items- Type
AccordionItem<string>[]- Default
- —
- Requirement
- required
- Prop
type- Type
"single" | "multiple" | undefined- Default
"single"- Requirement
- optional
- Prop
modelValue- Type
string[] | undefined- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string[] | undefined- Default
- —
- Requirement
- optional
- Prop
id- Type
string | undefined- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
update:modelValue | [value: string[]] |
Content regions
contenttrigger
Import
import { Component, signal } from "@angular/core";
import { GrassrootAccordion } from "@grassroot/ui-angular";
Props
Prop
Type
Default
Requirement
itemsAccordionItem[]—
required
typeAccordionType"single"optional
idstring"grassroot-accordion"optional
valuestring[][]optional
- Prop
items- Type
AccordionItem[]- Default
- —
- Requirement
- required
- Prop
type- Type
AccordionType- Default
"single"- Requirement
- optional
- Prop
id- Type
string- Default
"grassroot-accordion"- Requirement
- optional
- Prop
value- Type
string[]- Default
[]- Requirement
- optional
Events
| Event | Payload |
|---|---|
valueChange | string[] |
Import
import { Accordion } from "@grassroot/ui-svelte";
Props
Prop
Type
Default
Requirement
itemsAccordionItem[]—
required
type"single" | "multiple""single"optional
valuestring[]—
optional
defaultValuestring[]—
optional
idstring—
optional
classNamestring—
optional
onValueChange(value: string[]) => void—
optional
- Prop
items- Type
AccordionItem[]- Default
- —
- Requirement
- required
- Prop
type- Type
"single" | "multiple"- Default
"single"- Requirement
- optional
- Prop
value- Type
string[]- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
string[]- Default
- —
- Requirement
- optional
- Prop
id- Type
string- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
- Prop
onValueChange- Type
(value: string[]) => void- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onValueChange | (value: string[]) => void |
Content regions
contenttrigger
Import
import { Accordion } from "@grassroot/ui-solid";
import type { JSX } from "solid-js";
Props
Prop
Type
Default
Requirement
itemsAccordionItem<TValue>[]—
required
type"single" | "multiple"—
optional
valueTValue[]—
optional
defaultValueTValue[]—
optional
onValueChange(value: TValue[]) => void—
optional
classNamestring—
optional
idstring—
optional
- Prop
items- Type
AccordionItem<TValue>[]- Default
- —
- Requirement
- required
- Prop
type- Type
"single" | "multiple"- Default
- —
- Requirement
- optional
- Prop
value- Type
TValue[]- Default
- —
- Requirement
- optional
- Prop
defaultValue- Type
TValue[]- Default
- —
- Requirement
- optional
- Prop
onValueChange- Type
(value: TValue[]) => void- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
- Prop
id- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onValueChange | (value: TValue[]) => void |