npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2025 – Pkg Stats / Ryan Hefner

darkmode-react-component

v0.1.10

Published

**Effortlessly toggle between light and dark modes in your React projects!** A simple yet powerful component for bringing dark mode to your users. Give your application the look it deserves, day or night! 🌞🌚

Downloads

14

Readme

πŸŒ— DarkMode-React

Effortlessly toggle between light and dark modes in your React projects! A simple yet powerful component for bringing dark mode to your users. Give your application the look it deserves, day or night! 🌞🌚

πŸ”— πŸš€ Live Preview


πŸ“– Table of Contents


βš™οΈ Installation Guide

Get started in seconds with npm! 🎯

npm install --save darkmode-react-component

πŸ’‘ Basic Usage

Add DarkModeReact to your project with just a few lines:

import DarkModeReact from 'darkmode-react-component';

<DarkModeReact />

And that’s it! Your users can now switch between themes seamlessly! ⚑


βš™οΈ Props & Customization

Fine-tune the behavior of your dark mode switch with these props:

πŸ”’ hiddenLabel

Hide the default label for a cleaner look:

<DarkModeReact hiddenLabel />

πŸ‘οΈ hiddenIcon

Prefer no icons? This one’s for you:

<DarkModeReact hiddenIcon />

🌚 labelDark & 🌞 labelLight

Customize the labels for a personal touch:

<DarkModeReact labelDark="Tema escuro" labelLight="Tema claro" />

🎨 Style Customization

Match the theme switch to your brand’s identity! Here’s how you can modify the colors:

body {
  --dm-color-primary: #41b883; /* Primary color */
  --dm-color-secondary: #34495e; /* Secondary color */
  --dm-color-text: #222; /* Text color in light mode */
  --dm-color-background: #fff; /* Background color in light mode */
}

body.darkmode {
  --dm-color-text: #fff; /* Text color in dark mode */
  --dm-color-background: #222; /* Background color in dark mode */
}

πŸ’‘ Pro Tip: Use custom CSS variables to ensure consistency across your app, and let the .darkmode class do the magic! ✨


πŸ“š Component Details

When you use DarkModeReact, the following happens:

  • βœ… The body tag gets a .darkmode class based on the current theme.
  • πŸ’Ύ A LocalStorage key saves the user's theme preference, so their choice sticks even when they refresh the page!
  • 🎨 Style your app's components by targeting .darkmode in your stylesheets.

Why choose DarkModeReact?

  • ⚑ Quick to implement: Integrate in just a few lines.
  • 🎨 Highly customizable: Tweak styles to match your brand.
  • 🌍 Universal appeal: Users love dark mode, and it’s better for their eyes!
  • πŸ’ͺ Optimized for performance: Fast, efficient, and user-friendly.

⭐ Show Some Love!

Found this component useful? Star ⭐ the repository, share it with fellow developers, and contribute your ideas! Let's build a stylish and accessible web, together! πŸ’–

Got any suggestions or issues? Head over to the Issues section or open a Pull Request. Contributions are always welcome! πŸ™Œ


πŸš€ Join the Dark Side... Or Not!

DarkMode-React makes it easy to let users decide their preferred experience. With smooth transitions, customizable styles, and a straightforward setup, it’s the perfect addition to any modern React app.