Toggle
Modo de exibição
import { Toggle } from '@rivocode/ui'Quando usar
Botão que fica apertado. Vive dentro de um ToggleGroup.
No React Native
Traduz: o @rivocode/ui-native exporta Toggle - pressed e onPressedChange. 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 |
|---|---|
defaultPressed0.4.0Whether the toggle button is currently pressed. | boolean |
disabled0.4.0Whether the component should ignore user interaction. | boolean |
nativeButton0.4.0Whether the component renders a native `<button>` element when replacing it via the `render` prop. | boolean |
onPressedChange0.4.0Callback fired when the pressed state is changed. | ((pressed: boolean, eventDetails: { reason: "none"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; }) => void) |
pressed0.4.0Whether the toggle button is currently pressed. | boolean |
render0.4.0Allows you to replace the component's HTML element with a different tag, or compose it with another component. | ComponentRenderFn<HTMLProps, ToggleState>ReactElement<unknown, stringJSXElementConstructor<any>> |
value0.4.0A unique string that identifies the toggle when used inside a toggle group. | string |
Além destas, a peça aceita className, style, id e children, repassados ao elemento de baixo.