
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@blimu/react
Advanced tools
React components and hooks for Blimu authentication and authorization.
UserButtonuseAuth, useUser, and morenpm install @blimu/react
# or
yarn add @blimu/react
# or
pnpm add @blimu/react
This library requires:
react ^18.0.0 || ^19.0.0react-dom ^18.0.0 || ^19.0.0tailwindcss ^4.0.0 (optional, but recommended)import { BlimuProvider } from '@blimu/react';
import '@blimu/react/styles';
function App() {
return (
<BlimuProvider publishableKey="pk_...">
<YourApp />
</BlimuProvider>
);
}
import { UserButton } from '@blimu/react';
function Header() {
return (
<header>
<h1>My App</h1>
<UserButton />
</header>
);
}
import { useAuth, useUser } from '@blimu/react';
function Dashboard() {
const { isAuthenticated, login, logout } = useAuth();
const { user } = useUser();
if (!isAuthenticated) {
return <button onClick={() => login()}>Sign In</button>;
}
return (
<div>
<h1>Welcome, {user?.firstName}!</h1>
<button onClick={() => logout()}>Sign Out</button>
</div>
);
}
If you're using Tailwind CSS v4, import the stylesheet in your app:
import '@blimu/react/styles';
This gives you the default Blimu theme with dark mode support.
Customize colors and border radius via the theme prop:
<BlimuProvider
publishableKey="pk_..."
theme={{
colors: {
primary: 'oklch(0.5 0.2 250)', // Custom blue
background: '#ffffff', // Hex colors work too
foreground: 'rgb(0, 0, 0)', // Or RGB
},
radius: 'lg', // 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | custom CSS value
}}
>
<YourApp />
</BlimuProvider>
Override CSS variables in your global styles:
/* your-app.css */
:root {
--blimu-primary: oklch(0.45 0.25 264);
--blimu-primary-foreground: oklch(1 0 0);
--blimu-radius: 0.5rem;
/* See full list of variables below */
}
.dark {
--blimu-primary: oklch(0.7 0.2 264);
--blimu-background: oklch(0.15 0 0);
}
Available CSS Variables:
/* Colors */
--blimu-background
--blimu-foreground
--blimu-card
--blimu-card-foreground
--blimu-popover
--blimu-popover-foreground
--blimu-primary
--blimu-primary-foreground
--blimu-secondary
--blimu-secondary-foreground
--blimu-muted
--blimu-muted-foreground
--blimu-accent
--blimu-accent-foreground
--blimu-destructive
--blimu-destructive-foreground
--blimu-border
--blimu-input
--blimu-ring
/* Border Radius */
--blimu-radius
Every component accepts className and classes props:
<UserButton
className="custom-user-button"
classes={{
trigger: 'hover:scale-105 transition-transform',
avatar: 'ring-2 ring-blue-500',
popover: 'shadow-2xl',
userName: 'font-bold',
}}
onManageAccount={() => router.push('/settings')}
/>
Blimu components automatically support dark mode when a .dark class is present on any parent element:
// Using next-themes
import { ThemeProvider } from 'next-themes';
<ThemeProvider attribute="class">
<BlimuProvider publishableKey="pk_...">
<YourApp />
</BlimuProvider>
</ThemeProvider>
Or manually:
<div className="dark">
<BlimuProvider publishableKey="pk_...">
<YourApp />
</BlimuProvider>
</div>
A button that displays the current user's avatar and provides account management options.
import { UserButton } from '@blimu/react';
<UserButton
className="custom-class"
classes={{
trigger: 'hover:opacity-90',
avatar: 'ring-2 ring-primary',
popover: 'shadow-xl',
userName: 'font-semibold',
manageAccountButton: 'hover:bg-accent',
signOutButton: 'hover:bg-destructive/10',
}}
onManageAccount={() => {
// Navigate to account settings
}}
/>
Props:
className?: string - Custom class for the root elementclasses?: object - Object of classes for sub-elementsonManageAccount?: () => void - Callback when "Manage account" is clickedRedirects unauthenticated users to the sign-in page.
import { RedirectToSignIn } from '@blimu/react';
function ProtectedPage() {
return (
<>
<RedirectToSignIn returnUrl="/dashboard" />
<Dashboard />
</>
);
}
Access authentication state and methods.
import { useAuth } from '@blimu/react';
function Component() {
const {
state, // Full auth state object
isAuthenticated, // Boolean
isLoading, // Boolean
login, // (returnUrl?) => void
logout, // () => Promise<void>
getToken, // (options) => Promise<string | null>
} = useAuth();
}
Get the current user object.
import { useUser } from '@blimu/react';
function Profile() {
const { user } = useUser();
return (
<div>
<h1>{user?.firstName} {user?.lastName}</h1>
<p>{user?.email}</p>
</div>
);
}
User object:
interface User {
id: string;
email: string;
firstName?: string | null;
lastName?: string | null;
emailVerified: boolean;
}
Access the Blimu client and configuration.
import { useBlimu } from '@blimu/react';
function Component() {
const { client, config } = useBlimu();
}
Full TypeScript support with exported types:
import type {
User,
AuthState,
BlimuConfig,
BlimuTheme,
BlimuThemeColors,
UserButtonProps,
} from '@blimu/react';
// Type-safe theme configuration
const theme: BlimuTheme = {
colors: {
primary: 'oklch(0.5 0.2 250)',
},
radius: 'lg',
};
// Component props are fully typed
const userButtonProps: UserButtonProps = {
className: 'my-button',
onManageAccount: () => console.log('Account'),
};
// app/layout.tsx
import { BlimuProvider } from '@blimu/react';
import '@blimu/react/styles';
export default function RootLayout({ children }) {
return (
<html>
<body>
<BlimuProvider publishableKey={process.env.NEXT_PUBLIC_BLIMU_PUBLISHABLE_KEY!}>
{children}
</BlimuProvider>
</body>
</html>
);
}
// pages/_app.tsx
import { BlimuProvider } from '@blimu/react';
import '@blimu/react/styles';
import type { AppProps } from 'next/app';
export default function App({ Component, pageProps }: AppProps) {
return (
<BlimuProvider publishableKey={process.env.NEXT_PUBLIC_BLIMU_PUBLISHABLE_KEY!}>
<Component {...pageProps} />
</BlimuProvider>
);
}
// main.tsx
import { BlimuProvider } from '@blimu/react';
import '@blimu/react/styles';
import ReactDOM from 'react-dom/client';
import App from './App';
ReactDOM.createRoot(document.getElementById('root')!).render(
<BlimuProvider publishableKey={import.meta.env.VITE_BLIMU_PUBLISHABLE_KEY}>
<App />
</BlimuProvider>
);
// app/root.tsx
import { BlimuProvider } from '@blimu/react';
import styles from '@blimu/react/styles';
export const links = () => [
{ rel: 'stylesheet', href: styles },
];
export default function Root() {
return (
<html>
<head>
<Links />
</head>
<body>
<BlimuProvider publishableKey={process.env.BLIMU_PUBLISHABLE_KEY!}>
<Outlet />
</BlimuProvider>
</body>
</html>
);
}
import { useAuth, RedirectToSignIn } from '@blimu/react';
function ProtectedRoute({ children }) {
const { isAuthenticated, isLoading } = useAuth();
if (isLoading) {
return <div>Loading...</div>;
}
if (!isAuthenticated) {
return <RedirectToSignIn />;
}
return <>{children}</>;
}
import { useAuth } from '@blimu/react';
function ApiCall() {
const { getToken } = useAuth();
const fetchData = async () => {
const token = await getToken({ template: 'web' });
const response = await fetch('/api/data', {
headers: {
Authorization: `Bearer ${token}`,
},
});
};
}
Build your own components using the hooks:
import { useUser, useAuth } from '@blimu/react';
function CustomUserMenu() {
const { user } = useUser();
const { logout } = useAuth();
if (!user) return null;
return (
<div className="menu">
<img src={user.avatarUrl} alt={user.firstName} />
<span>{user.email}</span>
<button onClick={logout}>Sign Out</button>
</div>
);
}
See the examples directory for complete working examples:
Make sure you've imported the styles:
import '@blimu/react/styles';
If you're using Tailwind CSS v4 in your app, the Blimu components will inherit your Tailwind configuration.
Ensure a .dark class is added to a parent element:
<div className="dark">
<BlimuProvider>...</BlimuProvider>
</div>
Make sure @blimu/react is installed and your tsconfig.json has:
{
"compilerOptions": {
"moduleResolution": "bundler",
"jsx": "react-jsx"
}
}
Full API documentation available at docs.blimu.dev
MIT
FAQs
React components and hooks for Blimu authentication and authorization
We found that @blimu/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.