Accordion
Perguntas
import { Accordion } from '@rivocode/ui'Quando usar
Sanfona, para perguntas frequentes e para secoes longas de formulário.
O AccordionItem entrega cabeçalho, gatilho e painel numa peça só, porque a
Base UI exige a ordem exata entre eles e expor as partes soltas só criaria um
jeito de montar errado.
No React Native
Traduz: o @rivocode/ui-native exporta Accordion - cada AccordionItem guarda o próprio aberto; não há raiz controlada. Abre com a seta girando e o corpo em fade, e sem movimento quando o sistema pede para reduzir. A API não é a mesma do web (no nativo tudo é controlado), e a tabela de paridade diz o que muda peça a peça.
API
| Prop | Tipo |
|---|---|
defaultValue0.4.0The uncontrolled value of the item(s) that should be initially expanded. | AccordionValue<Value> |
disabled0.4.0Whether the component should ignore user interaction. | boolean |
hiddenUntilFound0.4.0Allows the browser's built-in page search to find and expand the panel contents. | boolean |
keepMounted0.4.0Whether to keep the element in the DOM while the panel is closed. | boolean |
loopFocus0.4.0Deprecated following the [APG guidance update](https://github.com/w3c/aria-practices/pull/3434) to remove roving focus. | boolean |
multiple0.4.0Whether multiple items can be open at the same time. | boolean |
onValueChange0.4.0Event handler called when an accordion item is expanded or collapsed. | ((value: AccordionValue<Value>, eventDetails: AccordionRootChangeEventDetails) => void) |
orientation0.4.0Deprecated following the [APG guidance update](https://github.com/w3c/aria-practices/pull/3434) to remove roving focus. | Orientation |
render0.4.0Allows you to replace the component's HTML element with a different tag, or compose it with another component. | ComponentRenderFn<HTMLProps, State<Value>>ReactElement<unknown, stringJSXElementConstructor<any>> |
value0.4.0The controlled value of the item(s) that should be expanded. | AccordionValue<Value> |
Além destas, a peça aceita className, style, id e children, repassados ao elemento de baixo.