Licence
MIT
Version
0.5.0
Deps
0
Size
51 kB
Vulns
0
Weekly
0
@nocp/toggle
React Toggle Component
By NriotHrreion
Installation
npm i @nocp/toggle
Usage
Import the component
import Toggle from "@nocp/toggle";
// style
import "@nocp/toggle/dist/toggle.css";
Use the component
<Toggle />
Props
| 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.
Styling
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;
}