Switch (Item)
caution
All props/parameters are optional unless they are marked with an asterisk ( * ).
Example
import { components } from "replugged";
const { SwitchItem } = components;
export function Settings(): React.ReactElement {
return <SwitchItem {...util.useSetting(cfg, "foo", true)}>Switch title</SwitchItem>;
}
Props
Name | Type | Default | Description |
---|---|---|---|
checked | * boolean | Switch state; use value with the Item component instead | |
className | string | Component class name | |
disabled | boolean | false | Whether the switch is disabled |
focusProps | Record<string, unknown> | Props for the FocusRing component | |
hideBorder | boolean | false | Whether a divider is not displayed at the end of the switch item |
id | string | Input element id | |
innerRef | Ref<unknown> | Inner ref | |
note | string | Description of what the switch item is about | |
onChange | * (value: boolean) => void | Function ran on state change | |
style | CSSProperties | Component style | |
tooltipNote | string | Tooltip text displayed on the switch item | |
value | * boolean | Switch item value |