You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-light-dark-toggle

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-light-dark-toggle

A customizable React toggle for changing between light and dark mode

1.1.0
latest
Source
npmnpm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

React Light Dark Toggle

Build Status Maintainability Test Coverage License: MIT

A customizable React switch for changing between light and dark mode.

Examples

Regular

RegularExample

Styled Like the Google Fonts Toggle

GoogleFontExample

Install

npm i react-light-dark-toggle

Usage and Demo

Visit The Storybook Page

Documentation

Component Props

PropertyPropTypeRequiredDefaultDescription
sunIconComponent``() => <img src={SunIconSrc} alt="light" />The component representing the light mode (sun) icon
moonIconComponent``() => <img src={MoonIconSrc} alt="dark" />The component representing the dark mode (moon) icon
showSunTransform``'translateY(0) translateX(-1em)'The transform to apply when showing the sun icon
hideSunTransform``'translateY(4em) translateX(-1em)'The transform to apply when hiding the sun icon
showMoonTransform``'translateY(0) translateX(1em)'The transform to apply when showing the moon icon
hideMoonTransform``'translateY(-4em) translateX(1em)'The transform to apply when hiding the moon icon
showSunFilter``''The filter to apply when showing the sun icon
hideSunFilter``''The filter to apply when hiding the sun icon
showMoonFilter``''The filter to apply when showing the moon icon
hideMoonFilter``''The filter to apply when hiding the moon icon
transitionDuration``'750ms'How long transitions should take (in ms)
onToggle``The action to apply on clicking the toggle
darkBorderColor``'grey'
lightBorderColor``'lightgrey'
darkBackgroundColor``'#222222'
lightBackgroundColor``'#EEEEEE'

Keywords

react

FAQs

Package last updated on 30 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts