0.1.10 β€’ Published 6 months ago

darkmode-react-component v0.1.10

Weekly downloads
-
License
-
Repository
github
Last release
6 months ago

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

0.1.10

6 months ago

0.1.9

6 months ago

0.1.8

9 months ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago