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 🙏

© 2024 – Pkg Stats / Ryan Hefner

darkmode-toggle-react

v1.1.3

Published

A customizable and easy-to-integrate React component for implementing a dark mode toggle switch.

Downloads

6

Readme

Darkmode-toggle-react

🌒 Looking for maintainers for Darkmode-toggle-react library

darkmode-toggle-react is a simple React component for implementing a dark mode toggle switch using Tailwind CSS or you can use customaized css instead.

You should consider using reactjs-popup for those couple of reasons :

  • ✅ Very tiny library
  • ✅ Fully accessible 🔓
  • ✅ Easy to use 💦
  • ✅ Full style customization 🧩 ( CSS, styled-components)
  • ✅ Default & Custom Animations

Demo

Installing / Getting started

To install and use the DarkMode Toggle React component in your project, follow these steps:

  1. Install the tailwindcss (optional):

to install Tailwind CSS, follow these steps: for more details go take a look at this docuentation install tailwindcss with react

Install Tailwind CSS:

1- Install Tailwind CSS and its dependencies using npm:

    npm install -D tailwindcss

2- Create a Tailwind Configuration File:

  • Generate a Tailwind CSS configuration file using the following command:
    npx tailwindcss init

This will create a tailwind.config.js file in your project directory.

3- Include Tailwind CSS Styles:

Include Tailwind CSS styles in your project. You can either import the styles directly into your CSS/SCSS file or include them via a link tag in your HTML file:

    <!-- In your HTML file -->
    <link href="path/to/tailwind.css" rel="stylesheet">

4- Set Up Dark Mode :

If you want to enable dark mode using Tailwind CSS, you can configure it in your tailwind.config.js file:

    // tailwind.config.js
    module.exports = {
    darkMode: 'class', // Enable dark mode based on the 'dark' class
    theme: {
        extend: {},
    },
    variants: {},
    plugins: [],
    };
  1. install darkModeToggle

This package is available in NPM repository as darkmode-toggle-react. It will work correctly with all popular bundlers.

install with npm
    npm i darkmode-toggle-react
install it with yarn
    yarn add darkmode-toggle-react

Include the Component

To start using darkModeToggle you just need to import the component from the darkmode-toggle-react package.

using tailwindCss

import React from 'react';
import { DarkModeToggle } from 'darkmode-toggle-react'

export default () => (
  <div className="bg-gray-200 text-gray-900 dark:bg-gray-900 dark:text-gray-300 min-h-screen min-w-full" >
        <DarkModeToggle />
  </div>
);

using css

    /* main.css file */
    .dark{
        background-color: #121212; /* Dark background color */
        color: #ffffff; /* Light text color for dark mode */
    }

    import React from 'react';
    import { DarkModeToggle } from 'darkmode-toggle-react'
    import main.css

    export default () => (
        <div className="" >
                <DarkModeToggle />
        </div>
    );

Contributing

Clone Repo

Fork and then clone the repo

git clone https://github.com/ouchkaih/Darkmode-toggle-react.git

Start Developing

Install all npm scripts:

npm install
or
yarn install

we use storybook to build popup use cases.

To start storybook:

yarn storybook

Run Test in watch mode

yarn test

To make contributing simply you need to create a new story for your use case under stories directory to demonstrate the new features or the bug fix .

Make Changes 😀.

Before submitting a pull request run npm run test to run the unit tests .

Licensing

The code in this project is licensed under MIT license.

Show your support!

Sponsor

if you are interested to Sponsor this library and list your logo in this section, Make sure to contact me.

Show Your Support

That's all, thank you for your attention, please [![Star on GitHub][github-star-badge]][github-star] the repo to show your support.

we are all made of stars [![Star on GitHub][github-star-badge]][github-star]