Import
import {
Accordion ,
AccordionItem ,
AccordionTrigger ,
AccordionContent
} from '@strongtie/design-system/accordion' ;
Usage
< Accordion type = "single" collapsible >
< AccordionItem value = "item-1" >
< AccordionTrigger >
Section 1
</ AccordionTrigger >
< AccordionContent >
Content for section 1.
</ AccordionContent >
</ AccordionItem >
</ Accordion >
<Accordion> Propstype
"single" | "multiple"
default: "\"single\""
The type of accordion. “single” allows only one item to be expanded at a time, while “multiple” allows multiple items to be expanded.
If true, allows the user to collapse an expanded item.
The controlled value(s) of the item(s) to expand.
The value(s) of the item(s) to expand when initially rendered.
If true, the accordion will be disabled.
onValueChange
(value: string | string[]) => void
Callback function that is called when the expanded state changes.
<AccordionItem> PropsThe value of the accordion item.
If true, the accordion item will render as a child component.
If true, the accordion item will be disabled.
Usage Examples Basic
Multiple
Default Expanded
Disabled Item
Controlled
< Accordion type = "single" collapsible >
< AccordionItem value = "item-1" >
< AccordionTrigger > Section 1 </ AccordionTrigger >
< AccordionContent > Content for section 1. </ AccordionContent >
</ AccordionItem >
< AccordionItem value = "item-2" >
< AccordionTrigger > Section 2 </ AccordionTrigger >
< AccordionContent > Content for section 2. </ AccordionContent >
</ AccordionItem >
</ Accordion >
Styling Classes The following CSS classes are applied by the Accordion components:
accordion-item – Base class for each accordion item.
accordion-header – Wrapper for the trigger.
accordion-trigger – The clickable element that toggles the item.
accordion-icon – Icon indicating expand/collapse state.
accordion-content – Wrapper for the collapsible content.
accordion-content-inner – Inner wrapper for content.
For more examples, visit the Storybook . < StudsAccordion Multiple = "true" >
< Items >
< StudsAccordionItem Text = "Orders" Icon = "account_balance_wallet" >
Details for Orders
</ StudsAccordionItem >
< StudsAccordionItem Text = "Employees" Icon = "account_box" >
Details for Employees
</ StudsAccordionItem >
< StudsAccordionItem Text = "Customers" Icon = "accessibility" >
Details for Customers
</ StudsAccordionItem >
</ Items >
</ StudsAccordion >
<StudsAccordion> ParametersGets or sets a value indicating whether multiple items can be expanded.
Gets or sets the index of the selected item.
Callback invoked when the selected index changes.
Callback invoked when an item is expanded.
Callback invoked when an item is collapsed.
The items to be displayed in the accordion.
Attributes
Dictionary<string, object>
Specifies additional custom attributes that will be rendered by the component.
MouseEnter
EventCallback<ElementReference>
Gets or sets the callback that is invoked when the mouse enters an item.
MouseLeave
EventCallback<ElementReference>
Gets or sets the callback that is invoked when the mouse leaves an item.
A callback that will be invoked when the user right-clicks the component. Commonly used to display a context menu.
Culture
CultureInfo
default: "CultureInfo.CurrentCulture"
Gets or sets the culture used to display localizable data (numbers, dates). Set by default to “CultureInfo.CurrentCulture”.
Gets or sets the inline CSS style.
Gets or sets a value indicating whether this “T:Studs.StudsComponent” is visible. Invisible components are not rendered.
<StudsAccordionItem> ParametersThe content inside the accordion item.
The aria-label for the collapse button.
The title for the collapse button.
Whether this item is disabled.
The aria-label for the expand button.
The title for the expand button.
Whether this item is selected.
Callback invoked when the selected state changes.
Whether this item is visible.
Usage Examples Basic
Multiple
Disabled Item
With Icons
< StudsAccordion >
< Items >
< StudsAccordionItem Text = "Section 1" >
Content for section 1.
</ StudsAccordionItem >
< StudsAccordionItem Text = "Section 2" >
Content for section 2.
</ StudsAccordionItem >
</ Items >
</ StudsAccordion >
Styling Classes The following CSS classes are applied by the Accordion components:
accordion – Root accordion container
accordion-item – Each accordion item
accordion-toggle-icon – The expand/collapse arrow icon
accordion-icon – The item’s icon
For more examples, visit the Storybook .