npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zalt.io/react

v1.0.0

Published

Zalt.io Authentication SDK - React hooks and components

Downloads

22

Readme

@zalt/react

React hooks and components for Zalt.io authentication. Beautiful, accessible, customizable.

Installation

npm install @zalt/core @zalt/react

Quick Start

import { ZaltProvider, useAuth, SignedIn, SignedOut, UserButton } from '@zalt/react';

function App() {
  return (
    <ZaltProvider realmId="your-realm-id">
      <Header />
      <MainContent />
    </ZaltProvider>
  );
}

function Header() {
  return (
    <header>
      <SignedIn>
        <UserButton />
      </SignedIn>
      <SignedOut>
        <a href="/sign-in">Sign In</a>
      </SignedOut>
    </header>
  );
}

Features

  • 🎣 React Hooks - useAuth, useUser, useMFA, useZaltClient
  • 🧩 Components - SignedIn, SignedOut, UserButton, SignInButton
  • 🎨 Theming - CSS variables, dark mode, customizable
  • Accessible - WCAG 2.1 AA compliant
  • 📦 Lightweight - < 3KB gzipped

API Reference

ZaltProvider

Wrap your app with ZaltProvider to enable authentication.

<ZaltProvider
  realmId="your-realm-id"
  apiUrl="https://api.zalt.io"  // Optional
  appearance={{                  // Optional theming
    theme: 'auto',              // 'light' | 'dark' | 'auto'
    variables: {
      colorPrimary: '#0066ff',
      borderRadius: '8px',
    },
  }}
>
  {children}
</ZaltProvider>

useAuth

Main authentication hook.

function Component() {
  const {
    user,              // Current user or null
    isLoading,         // Loading state
    isAuthenticated,   // Boolean
    signIn,            // (email, password) => Promise
    signUp,            // (email, password, profile?) => Promise
    signOut,           // () => Promise
  } = useAuth();

  const handleLogin = async () => {
    const result = await signIn('[email protected]', 'password');
    if (result.mfaRequired) {
      // Redirect to MFA page
    }
  };
}

useUser

Get current user data.

function Profile() {
  const { user, isLoading } = useUser();

  if (isLoading) return <Spinner />;
  if (!user) return <div>Not logged in</div>;

  return <div>Hello, {user.email}</div>;
}

useMFA

MFA setup and verification.

function MFASetup() {
  const { 
    setup,      // (method: 'totp' | 'webauthn') => Promise
    verify,     // (code: string) => Promise
    isLoading,
    qrCode,     // QR code data URL after setup
    backupCodes // Array of backup codes
  } = useMFA();

  return (
    <button onClick={() => setup('totp')}>
      Enable 2FA
    </button>
  );
}

useZaltClient

Access the raw ZaltClient for advanced use cases.

function Advanced() {
  const client = useZaltClient();
  
  // Direct API access
  await client.webauthn.register({ name: 'My Device' });
}

SignedIn / SignedOut

Conditional rendering based on auth state.

<SignedIn>
  <p>Welcome back!</p>
  <UserButton />
</SignedIn>

<SignedOut>
  <p>Please sign in</p>
  <SignInButton />
</SignedOut>

UserButton

User avatar with dropdown menu.

<UserButton 
  afterSignOutUrl="/"
  showName={true}
/>

SignInButton / SignUpButton

Pre-styled auth buttons.

<SignInButton mode="modal" />
<SignUpButton redirectUrl="/onboarding" />

Theming

Customize appearance with CSS variables:

<ZaltProvider
  realmId="your-realm-id"
  appearance={{
    theme: 'dark',
    variables: {
      colorPrimary: '#6366f1',
      colorBackground: '#1a1a2e',
      colorText: '#ffffff',
      fontFamily: 'Inter, sans-serif',
      borderRadius: '12px',
    },
  }}
>

Or use CSS:

:root {
  --zalt-color-primary: #6366f1;
  --zalt-color-background: #ffffff;
  --zalt-border-radius: 8px;
}

TypeScript

Full TypeScript support with exported types:

import type { User, AuthResult, ZaltConfig } from '@zalt/react';

License

MIT