
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@agney/react-dark-mode-toggle
Advanced tools
Rewrite of a cute dark mode toggle 🦉
Original library react-dark-mode-toggle was created by Alex Thoma. Credit goes out to those who helped build that library to what it is today. Let's see if we can take it even further.
This rewrite:
checked is true but the toggle initially renders in light-mode then snaps to dark-modereact-lottie-player to latest for TS support & to fix the above flickering problemreact-lottie-player is used to render a Lottie
file (i.e. a JSON payload) in a React component we call DarkModeToggle. This underlying library is a
peer dependency of the project which is why you'll see it in the installation instructions below.
npm:npm i react-dark-mode-toggle-2
yarn:yarn 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
onChange={setIsDarkMode}
isDarkMode={isDarkMode}
size={85}
/>
);
};
| Prop | Type | Default | Required |
|---|---|---|---|
onChange | func | N/A | Yes |
isDarkMode | boolean | 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 |
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.
FAQs
An updated, cute dark mode toggle button for React.
We found that @agney/react-dark-mode-toggle 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.