Skip to content

nocpiun/toggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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;
}

LICENSE

MIT