A button that stays pressed or unpressed, such as favourite or bold.
import { Toggle } from '@oztix/roadie-components/toggle'
<Toggle>Notify me</Toggle>
emphasis sets the look at rest. Pressed steps one rung up: normal and subtle become strong. A pressed subtler toggle takes a soft fill with no border and a strong icon or label, and an unpressed one rests in subtle text. The subtler selected state relies on the fill and the icon together and doesn't meet 3:1 on the fill alone, so it's for quiet controls. Use subtle or normal when the state must stand out.
The same sizes as Button. A toggle whose only child is an icon renders square.
The intent colours the pressed state most.
<div className='flex flex-wrap items-center gap-2'> <Toggle intent='accent' defaultPressed>Accent</Toggle> <Toggle intent='brand' defaultPressed>Brand</Toggle> <Toggle intent='danger' defaultPressed>Danger</Toggle> </div>
Control pressed to swap the icon. Icons take fill only when pressed.
Button.ToggleGroup, not a row of Toggles.<button> with aria-pressed, so screen readers announce it as a toggle button and read its state.Space and Enter toggle it.aria-label.Whether the toggle button is currently pressed. This is the controlled counterpart of `defaultPressed`.
Whether the toggle button is currently pressed. This is the uncontrolled counterpart of `pressed`.
Defaults to false.
Whether the component should ignore user interaction.
Defaults to false.
Callback fired when the pressed state is changed.
A unique string that identifies the toggle when used inside a toggle group.
CSS class applied to the element, or a function that returns a class based on the component's state.
Sets the colour palette. Inherits from the surrounding intent when unset.
Emphasis at rest. Pressed steps up: `normal` and `subtle` to `strong`, `subtler` to a soft fill with a strong icon or label.
Defaults to 'normal'.
Button sizes. A toggle whose only child is an icon renders square.
Defaults to 'md'.
Inherited from NativeButtonProps
Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`).
Defaults to true.