BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/emrocode/theme-provider

Theme Provider

emrocode/theme-provider
FreeComponent

A theme provider using @emrocode/umbra

Install it

npx shadcn@latest add https://style.emroco.de/r/theme-provider.json

Source

registry/blocks/theme-provider/theme-provider.tsxstyle.emroco.de/r/theme-provider.json
1"use client";
2
3import Umbra, { type Options } from "@emrocode/umbra";
4import { createContext, type ReactNode, useContext, useState } from "react";
5import { KeyboardShortcut } from "./plugins";
6
7const options: Partial<Options> = {
8 autoMatchTheme: true,
9 useColorScheme: ["#ffffff", "#000000"],
10 useStorage: "local",
11 usePlugins: [KeyboardShortcut],
12};
13
14const umb = new Umbra(options);
15
16const ThemeContext = createContext<{
17 theme: string;
18 toggleTheme: () => void;
19} | null>(null);
20
21export const ThemeProvider = ({ children }: { children: ReactNode }) => {
22 const [theme, setTheme] = useState<string>(umb.getCurrentTheme());
23
24 const toggleTheme = () => {
25 umb.toggleTheme();
26 setTheme(umb.getCurrentTheme());
27 };
28
29 return (
30 <ThemeContext.Provider value={{ theme, toggleTheme }}>
31 {children}
32 </ThemeContext.Provider>
33 );
34};
35
36export const useTheme = () => {
37 const context = useContext(ThemeContext);
38 if (!context) {
39 throw new Error("useTheme must be used within a ThemeProvider");
40 }
41 return context;
42};

What it pulls in

npm packages

  • @emrocode/umbra

Files it writes

  • registry/blocks/theme-provider/theme-provider.tsx
  • registry/blocks/theme-provider/plugins/index.ts
  • registry/blocks/theme-provider/plugins/kbd.plugin.ts

Facts

Registry
emrocode
Type
registry:component
Access
Free
Files written
3
Licence
the repository states none
First indexed
2026-08-04
Last confirmed
today

Go to the source

style.emroco.de emrocode/style on GitHub Raw registry item This item as JSON

More from emrocode

All 6 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
GitHub Cornergithub-corneremrocodeComponentsFreeno deps
HeroheroemrocodeComponentsFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex