You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AccordionPanel uses useFocusable, useCollectionItem, and
useDisclosureContent
useAccordionState uses useCompositeState
Props
AccordionOptions
Name
Type
Description
state
AccordionState
Object returned by the useAccordionState hook.
CompositeOptions props
> These props are returned by the other props You can also provide these props.
Name
Type
Description
disabled
boolean | undefined
Determines whether the focusable element is disabled. If the focusableelement doesn't support the native disabled attribute, thearia-disabled attribute will be used instead.
autoFocus
boolean | undefined
Automatically focus the element when it is mounted. It works similarly tothe native autoFocus prop, but solves an issue where the element isgiven focus before React effects can run.
focusable
boolean | undefined
Whether the element should be focusable.
accessibleWhenDisabled
boolean | undefined
Determines whether the element should be focusable even when it isdisabled.This is important when discoverability is a concern. For example:> A toolbar in an editor contains a set of special smart paste functionsthat are disabled when the clipboard is empty or when the function is notapplicable to the current content of the clipboard. It could be helpful tokeep the disabled buttons focusable if the ability to discover theirfunctionality is primarily via their presence on the toolbar.Learn more on Focusability of disabledcontrols.
Custom event handler that is called when the element is focused via thekeyboard or when a key is pressed while the element is focused.
composite
boolean | undefined
Whether the component should behave as a composite widget. This prop shouldbe set to false when combining different composite widgets where only oneshould behave as such.
focusOnMove
boolean | undefined
Whether the active composite item should receive focus whencomposite.move is called.
AccordionDisclosureOptions
Name
Type
Description
state
AccordionState | undefined
Object returned by the useAccordionState hook. If not provided, the parentAccordion component's context will be used.
CompositeItemOptions props
> These props are returned by the other props You can also provide these props.
Name
Type
Description
disabled
boolean | undefined
Determines whether the focusable element is disabled. If the focusableelement doesn't support the native disabled attribute, thearia-disabled attribute will be used instead.
autoFocus
boolean | undefined
Automatically focus the element when it is mounted. It works similarly tothe native autoFocus prop, but solves an issue where the element isgiven focus before React effects can run.
focusable
boolean | undefined
Whether the element should be focusable.
accessibleWhenDisabled
boolean | undefined
Determines whether the element should be focusable even when it isdisabled.This is important when discoverability is a concern. For example:> A toolbar in an editor contains a set of special smart paste functionsthat are disabled when the clipboard is empty or when the function is notapplicable to the current content of the clipboard. It could be helpful tokeep the disabled buttons focusable if the ability to discover theirfunctionality is primarily via their presence on the toolbar.Learn more on Focusability of disabledcontrols.
Custom event handler that is called when the element is focused via thekeyboard or when a key is pressed while the element is focused.
shouldRegisterItem
boolean | undefined
Whether the item should be registered to the state.
getItem
((props: Item) => Item) | undefined
A memoized function that returns props that will be passed along with theitem when it gets registered to the state.
clickOnEnter
boolean | undefined
If true, pressing the enter key will trigger a click on the button.
clickOnSpace
boolean | undefined
If true, pressing the space key will trigger a click on the button.
rowId
string | undefined
The id that will be used to group items in the same row. This isusually retrieved by the CompositeRow component through context so inmost cases you don't need to set it manually.
Whether the scroll behavior should be prevented when pressing arrow keyson the first or the last items.
AccordionPanelOptions
Name
Type
Description
state
AccordionState | undefined
Object returned by the useAccordionState hook.
accordionId
string | null | undefined
The id of the accordion that controls this panel. By default, this value willbe inferred based on the order of the accordions and the panels.
FocusableOptions props
> These props are returned by the other props You can also provide these props.
Name
Type
Description
disabled
boolean | undefined
Determines whether the focusable element is disabled. If the focusableelement doesn't support the native disabled attribute, thearia-disabled attribute will be used instead.
autoFocus
boolean | undefined
Automatically focus the element when it is mounted. It works similarly tothe native autoFocus prop, but solves an issue where the element isgiven focus before React effects can run.
focusable
boolean | undefined
Whether the element should be focusable.
accessibleWhenDisabled
boolean | undefined
Determines whether the element should be focusable even when it isdisabled.This is important when discoverability is a concern. For example:> A toolbar in an editor contains a set of special smart paste functionsthat are disabled when the clipboard is empty or when the function is notapplicable to the current content of the clipboard. It could be helpful tokeep the disabled buttons focusable if the ability to discover theirfunctionality is primarily via their presence on the toolbar.Learn more on Focusability of disabledcontrols.
Function that will be called when setting the accordion selectedId state.
CompositeStateProps props
> These props are returned by the other props You can also provide these props.
Name
Type
Description
items
T[]
Lists all the items with their refs. This state is automatically updatedwhen an item is registered or unregistered with the registerItemfunction. The order of the items is automatically defined by the order ofthe elements in the DOM.
setItems
((items: T[]) => void) | undefined
Function that will be called when setting the collection items state.
virtualFocus
boolean
If enabled, the composite element will act as anaria-activedescendantcontainer instead of rovingtabindex.DOM focus will remain on the composite while its items receive virtualfocus.
orientation
Orientation
Defines the orientation of the composite widget. If the composite has asingle row or column (one-dimensional), the orientation value determineswhich arrow keys can be used to move focus: - both: all arrow keys work. - horizontal: only left and right arrow keys work. - vertical: only up and down arrow keys work.It doesn't have any effect on two-dimensional composites.
rtl
boolean
Determines how the next and previous functions will behave. If rtl isset to true, they will be inverted. This only affects the compositewidget behavior. You still need to set dir="rtl" on HTML/CSS.
focusLoop
boolean | Orientation
On one-dimensional composites: - true loops from the last item to the first item and vice-versa. - horizontal loops only if orientation is horizontal or not set. - vertical loops only if orientation is vertical or not set. - If activeId is initially set to null, the composite element will be focused in between the last and first items.On two-dimensional composites: - true loops from the last row/column item to the first item in the same row/column and vice-versa. If it's the last item in the last row, it moves to the first item in the first row and vice-versa. - horizontal loops only from the last row item to the first item in the same row. - vertical loops only from the last column item to the first item in the column row. - If activeId is initially set to null, vertical loop will have no effect as moving down from the last row or up from the first row will focus the composite element. - If focusWrap matches the value of focusLoop, it'll wrap between the last item in the last row or column and the first item in the first row or column and vice-versa.
focusWrap
boolean | Orientation
Has effect only on two-dimensional composites. If enabled, moving tothe next item from the last one in a row or column will focus the firstitem in the next row or column and vice-versa. - true wraps between rows and columns. - horizontal wraps only between rows. - vertical wraps only between columns. - If focusLoop matches the value of focusWrap, it'll wrap between the last item in the last row or column and the first item in the first row or column and vice-versa.
focusShift
boolean
Has effect only on two-dimensional composites. If enabled, moving upor down when there's no next item or the next item is disabled will shiftto the item right before it.
moves
number
The number of times the move function has been called.
includesBaseElement
boolean
Indicates whether the Composite element should be included in the focusorder.
activeId
string | null | undefined
The current focused item id. - undefined will automatically focus the first enabled composite item. - null will focus the base composite element and users will be able to navigate out of it using arrow keys. - If activeId is initially set to null, the base composite element itself will have focus and users will be able to navigate to it using arrow keys.
defaultActiveId
string | null | undefined
The composite item id that should be focused when the composite isinitialized.
setMoves
((moves: number) => void) | undefined
Function that will be called when setting the composite moves state.