Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nextjs-themes

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nextjs-themes

Unleash the Power of React Server Components! Use multiple themes on your site with confidence, without losing any advantages of React Server Components.

  • 4.0.0-alpha.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1K
decreased by-49.15%
Maintainers
1
Weekly downloads
 
Created
Source

Nextjs Themes

test Maintainability codecov Version Downloads npm bundle size Gitpod ready-to-code

Nextjs Themes is a comprehensive library designed to unlock the full potential of React 18 server components. It provides customizable loading animation components and a fullscreen loader container, seamlessly integrating with React and Next.js.

✅ Fully Treeshakable (import from nextjs-themes/client/loader-container)

✅ Fully TypeScript Supported

✅ Leverages the power of React 18 Server components

✅ Compatible with all React 18 build systems/tools/frameworks

✅ Documented with Typedoc (Docs)

✅ Examples for Next.js, Vite, and Remix

Please consider starring this repository and sharing it with your friends.

Getting Started

Installation

$ pnpm add nextjs-themes

or

$ npm install nextjs-themes

or

$ yarn add nextjs-themes

Want Lite Version? npm bundle size Version Downloads

$ pnpm add nextjs-themes-lite

or

$ npm install nextjs-themes-lite

or

$ yarn add nextjs-themes-lite

You need r18gs as a peer-dependency

Import Styles

You can import styles globally or within specific components.

/* globals.css */
@import "nextjs-themes/dist";
// layout.tsx
import "nextjs-themes/dist/index.css";

For selective imports:

/* globals.css */
@import "nextjs-themes/dist/client"; /** required if you are using LoaderContainer */
@import "nextjs-themes/dist/server/bars/bars1";

Usage

Using loaders is straightforward.

import { Bars1 } from "nextjs-themes/dist/server/bars/bars1";

export default function MyComponent() {
  return someCondition ? <Bars1 /> : <>Something else...</>;
}

For detailed API and options, refer to the API documentation.

Using LoaderContainer

LoaderContainer is a fullscreen component. You can add this component directly in your layout and then use useLoader hook to toggle its visibility.

// layout.tsx
<LoaderContainer />
	 ...
// some other page or component
import { useLoader } from "nextjs-themes/dist/hooks";

export default MyComponent() {
	const { setLoading } = useLoader();
	useCallback(()=>{
		setLoading(true);
		...do some work
		setLoading(false);
	}, [])
	...
}

License

This library is licensed under the MPL-2.0 open-source license.

Please consider enrolling in our courses or sponsoring our work.


with 💖 by Mayank Kumar Chaudhari

Keywords

FAQs

Package last updated on 18 Jun 2024

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc