JSPM

night-stars

1.0.1
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 3
    • Score
      100M100P100Q26192F
    • License MIT

    Package Exports

    • night-stars
    • night-stars/dist/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (night-stars) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Night Stars

    A beautiful React component for toggling between day and night modes with animated stars.

    Features

    • Smooth transition between day and night modes
    • Interactive star animations
    • Customizable sun and moon icons
    • TypeScript support
    • Zero dependencies (except peer dependencies)

    Installation

    npm install night-stars
    
    ## Usage
    
    ```jsx
    import { ThemeProvider, DaynightToggle } from 'night-stars';
    
    function App() {
      return (
        <ThemeProvider>
          <div style={{ height: '100vh' }}>
            <DaynightToggle>
              {/* Your content here */}
            </DaynightToggle>
          </div>
        </ThemeProvider>
      );
    }

    To use the theme state in your components:

    import { useTheme } from 'night-stars';
    
    function MyComponent() {
      const { darkMode, toggleTheme } = useTheme();
    
      return (
        <button onClick={toggleTheme}>
          Current theme: {darkMode ? 'Dark' : 'Light'}
        </button>
      );
    }

    Requirements

    • React 16.8.0 or later
    • react-dom 16.8.0 or later
    • lucide-react

    License

    MIT