UNPKG

@neynar/ui

Version:

React UI component library built on shadcn/ui and Tailwind CSS

14 lines (9 loc) 926 B
# Theme **Type**: component Theme - Prevents flash of unstyled content (FOUC) during theme initialization A critical component that prevents the flash of incorrect theme styling by applying the user's preferred theme before the page renders. This component should be placed once at the root of your application, ideally in the document head or at the very beginning of the body. The component works by injecting a small inline script that: 1. Reads the stored theme preference from cookies 2. Detects system theme preference if set to "system" 3. Applies the appropriate theme class and color scheme immediately 4. Executes synchronously before first paint to prevent FOUC Built as a zero-configuration component that requires no props or setup. Simply drop it into your application's root layout and it will handle theme initialization automatically. ## JSX Usage ```jsx import { Theme } from '@neynar/ui'; <Theme /> ```