Socket
Book a DemoInstallSign in
Socket

darkmode-react-component

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

darkmode-react-component

**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! 🌞🌚

0.1.10
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
Β 
Created
Source

πŸŒ— 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.

FAQs

Package last updated on 29 Jan 2025

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.