useSwitch

A custom React hook that provides a simple way to manage boolean state with convenient methods for turning on, off, and toggling the switch.

Import

import { useSwitch } from '@vortex-kit/vortex';

Display

const { isEnabled, turnOn, turnOff, flipSwitch } = useSwitch(defaultValue);

Return Value

Prop
Type
Default
isEnabled
boolean
turnOn
function
turnOff
function
flipSwitch
function

Parameters

Prop
Type
Default
defaultValue
boolean
false
useSwitch Hook Props — Vortex Design System