| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Zero runtime, zero React re-renders, and a simple developer experience. Say goodbye to context and prop-drilling.
Website | See the proof | Quick Start | API Reference | Usage Examples | Migration Guide | FAQ | Contributing
Why re-render UI if all states are known at build time? React Zero-UI pre-renders UI states at build time, then flips data-* attributes to update the interface.
Example:
const [, setTheme] = useUI("theme", "dark");
// Flip theme to "light"
setTheme("light"); // data-theme="light" on bodyTailwind usage: Anywhere in your app
<div class="theme-dark:bg-black theme-light:bg-white">Fast & Reactive</div>React Zero-UI uses a hyper-optimized AST resolver in development that scans your codebase for:
This generates:
Zero-UI CLI
Prerequisites:
npx create-zero-uiFor manual configuration, see Next.js Installation or Vite Installation
Start your app and use Zero-UI.
Basic shape:
const [<staleValue>, <setterFunction>] = useUI(<stateKey>, <defaultValue>);Simple hook with the same shape as React's useState:
import { useUI } from "@react-zero-ui/core";
const [theme, setTheme] = useUI("theme", "dark");Features:
Control UI states at the element-level:
+ import { useScopedUI } from '@react-zero-ui/core';
const [theme, setTheme] = useScopedUI("theme", "dark");
// Flips data-* on the specific ref element
+ <div ref={setTheme.ref}
// Set the data-* to the staleValue to prevent FOUC
+ data-theme={theme}
>
Scoped UI Here
</div>Features:
Sometimes CSS variables are more efficient. React Zero-UI supports them by passing the CssVar option:
+ Pass `CssVar` to either hook to use CSS variables
useUI(<cssVariable>, <defaultValue>, CssVar);
Automatically adds -- to the CSS variable.
Global CSS Variable:
+ import { CssVar } from '@react-zero-ui/core';const [blur, setBlur] = useUI("blur", "0px", CssVar);
setBlur("5px"); // body { --blur: 5px }Scoped CSS Variable:
const [blur, setBlur] = useScopedUI("blur", "0px", CssVar);
<div
ref={setBlur.ref}
style={{ "--blur": blur }}>
Scoped blur effect.
</div>;Enable client-side interactivity without leaving server components. About 300 bytes of runtime overhead.
See experimental for more details.
React Zero-UI is a fast, simple way to handle global and scoped UI state in modern React apps without extra re-renders or prop drilling.
| Guide | Description |
|---|---|
| API Reference | Complete API documentation for all hooks and utilities |
| Usage Examples | Practical patterns and real-world use cases |
| Migration Guide | Step-by-step migration from useState, Context, Redux |
| FAQ | Frequently asked questions and answers |
| Experimental Features | SSR-safe server component interactivity |
| Framework | Guide |
|---|---|
| Next.js App Router | Complete Next.js setup with SSR support |
| Vite + React | Vite configuration and optimization |
We welcome bug fixes, feature requests, documentation improvements, and performance work from the community.
Get involved:
First-time contributor? Look for issues labeled good-first-issue.
| Back | FazBrowse Home | New Git URL |