
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
react-dark-mode-toggle-2
Advanced tools
A cute dark mode toggle 🦉
yarn add react-dark-mode-toggle-2
or
npm install react-dark-mode-toggle-2 --save
or
pnpm add react-dark-mode-toggle-2
import React from "react";
import { DarkModeToggle } from "react-dark-mode-toggle-2";
export const YourComponent = () => {
const [isDarkMode, setIsDarkMode] = React.useState(false);
return (
<DarkModeToggle
isDarkMode={isDarkMode}
onChange={setIsDarkMode}
/>
);
};
| Prop | Type | Default | Required |
|---|---|---|---|
attributes | optional object containing attributes to spread onto the button | ||
isDarkMode | boolean | N/A | Yes |
onChange | function that recieves a single argument: the new value of isDarkMode | N/A | Yes |
size | number (defaults to px) or a string containing a number+unit (e.g "10px", "2em", "4.5rem", "100%", etc). These units may also have a space between them (e.g. "10 px", "2 em", etc). | 85px | No |
speed | number | 1.3 | No |
className | string | '' | No |
id | string | '' | No |
Note, this is not a dark mode theme implementation; it's just a button! You'll need to mix this with a management solution such as use-dark-mode.
In Chrome, you may experience a blue outline around the toggle button after clicking it. If this behavior concerns you see this issue for more information and available workarounds.
Original library react-dark-mode-toggle was created by Alex Thoma. Credit to them and the community for the original work.
FAQs
An updated, cute dark mode toggle button for React.
The npm package react-dark-mode-toggle-2 receives a total of 111 weekly downloads. As such, react-dark-mode-toggle-2 popularity was classified as not popular.
We found that react-dark-mode-toggle-2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.