Reflex Cloud - Fast, secure & scalable hosting. One command to deploy.

Accordion

An accordion is a vertically stacked set of interactive headings that each reveal an associated section of content. The accordion component is made up of accordion, which is the root of the component and takes in an accordion.item, which contains all the contents of the collapsible section.

Basic Example

Styling

Type

We use the type prop to determine whether multiple items can be opened at once. The allowed values for this prop are single and multiple where single will only open one item at a time. The default value for this prop is single.

Default Value

We use the default_value prop to specify which item should open by default. The value for this prop should be any of the unique values set by an accordion.item.

The second accordion item's content

Collapsible

We use the collapsible prop to allow all items to close. If set to False, an opened item cannot be closed.

Disable

We use the disabled prop to prevent interaction with the accordion and all its items.

Orientation

We use orientation prop to set the orientation of the accordion to vertical or horizontal. By default, the orientation will be set to vertical. Note that, the orientation prop wont change the visual orientation but the functional orientation of the accordion. This means that for vertical orientation, the up and down arrow keys moves focus between the next or previous item, while for horizontal orientation, the left or right arrow keys moves focus between items.

Variant

Color Scheme

We use the color_scheme prop to assign a specific color to the accordion background, ignoring the global theme.

Value

We use the value prop to specify the controlled value of the accordion item that we want to activate. This property should be used in conjunction with the on_value_change event argument.

AccordionItem

The accordion item contains all the parts of a collapsible section.

Styling

Value

Disable

API Reference

rx.accordion.root

An accordion component.

PropType | ValuesDefaultInteractive
type
"single" | "multiple"
value
Union[str, List]
default_value
Union[str, List]
collapsible
bool
disabled
bool
dir
"ltr" | "rtl"
orientation
"vertical" | "horizontal"
radius
"none" | "small" | ...
duration
int
LiteralVar.create(DEFAULT_ANIMATION_DURATION)
easing
str
LiteralVar.create(DEFAULT_ANIMATION_EASING)
show_dividers
bool
color_scheme
"tomato" | "red" | ...
variant
"classic" | "soft" | ...
as_child
bool

Valid Children

AccordionItem

Event Triggers

See the full list of default event triggers
TriggerDescription
on_value_change Fired when the opened the accordions changes.

rx.accordion.item

An accordion component.

PropType | ValuesDefaultInteractive
value
str
disabled
bool
header
Union[Component, str]
content
Union[Component, str]
Var.create(None)
color_scheme
"tomato" | "red" | ...
variant
"classic" | "soft" | ...
as_child
bool

Valid Children

AccordionHeaderAccordionTriggerAccordionContent