React Toggle Component
By NriotHrreion
npm i @nocp/toggle
Import the component
import Toggle from "@nocp/toggle";
// style
import "@nocp/toggle/dist/toggle.css";
Use the component
<Toggle />
Name | Type | Required | Description |
---|---|---|---|
defaultToggleValue |
boolean |
No | The default value of the toggle |
onToggle |
(isActive: boolean) => void |
No | Toggling event of the toggle |
Also, the component supports HTML attributes.
The color style of the component can be changed by overriding the following CSS variables.
:root {
--nocp-toggle-bar-bg: #9e9e9e;
--nocp-toggle-knob-bg: #dbdbdb;
}