UI Components
Themed, customisable React components for sign-in, user management, and enterprise setup.
@wocha/ui provides pre-built, themed React components for Wocha authentication. Use them alongside @wocha/react (SPAs) or @wocha/nextjs (App Router) for polished auth UI without building forms from scratch.
For unstyled, headless primitives, see @wocha/react — UI components wrap the same auth context with CSS custom properties and accessible markup.
Installation
pnpm add @wocha/ui @wocha/reactnpx @wocha/cli init --framework nextjsFor Next.js apps, install @wocha/nextjs instead of @wocha/react:
pnpm add @wocha/ui @wocha/nextjsnpx @wocha/cli init --framework nextjsImport the stylesheet once in your root layout or entry file:
Peer dependencies: React 18+, and one of @wocha/react or @wocha/nextjs.
Quick start
Components
<SignIn> and <SignUp>
Styled auth forms that redirect to Wocha hosted login or registration.
| Prop | Description |
|---|---|
redirectUrl | URL to return to after auth |
organisation | Organisation ID hint for hosted login |
providers | Social buttons to show (google, github, apple, microsoft) |
passkeys | Show passkey sign-in button |
appearance | Per-component theme overrides |
withCard | Wrap in AuthCard (default: true) |
<UserButton>
Dropdown with avatar, name, email, and menu actions (Profile, Organisation, Sign out).
Use variant="compact" for avatar-only display.
<OrgSwitcher>
Organisation switcher for multi-org users.
<Protect>
Conditional rendering based on authentication, roles, or SpiceDB permissions.
Combine role and permission — both must pass when both are set.
Passkey components
<PasskeyButton> handles WebAuthn registration and authentication. Enable passkeys on <SignIn passkeys /> or use the button standalone:
Requires passkey endpoints configured in your auth handler (see Passkeys guide).
<UserProfile> and <UserPortal>
Full-page account management with profile editing, password settings, MFA (TOTP and backup codes), passkey management, session revocation, connected social accounts, and organisation membership. Requires apiUrl on your provider.
<OrganizationProfile>
Organisation management with overview, members, settings, and enterprise SSO status. Uses the Customer API with the signed-in user's access token.
Tabs: Overview, Members (invite, role management, remove with confirmation), Settings, Security (SSO connection status).
Interactive tools
- Theme editor — customise colours, radius, and typography with live preview
- Component playground — toggle props and copy JSX for UI components
<AuthCard>
Styled card wrapper used internally by <SignIn> and <SignUp>. Available for custom auth UI:
Headless vs styled modes
| Layer | Package | Use when |
|---|---|---|
| Headless | @wocha/react | You want full control over markup and styling |
| Styled | @wocha/ui | You want production-ready components with theming |
Headless components from @wocha/react (SignIn, SignOut, Protect, Authenticated) expose behaviour without CSS. UI components add .wocha- scoped styles, keyboard navigation, ARIA semantics, and theme variables on top of the same auth context.
You can mix both — use UI components for auth pages and headless hooks elsewhere:
Theming and customisation
All styles use CSS custom properties with the .wocha- prefix to avoid conflicts with your app.
Theme provider
Per-component overrides via the appearance prop on individual components.
Theme editor
Use the interactive Theme Editor to preview colours, radius, and typography, then copy the generated WochaThemeProvider configuration into your app.
Raw CSS
Framework integration
UI components work with any React setup that provides Wocha auth context:
| Framework | Provider | Theme provider |
|---|---|---|
| React SPA | WochaProvider from @wocha/react | WochaThemeProvider |
| Next.js App Router | WochaSessionProvider from @wocha/nextjs/client | WochaThemeProvider sdk="nextjs" |
Set apiUrl on both the session provider and theme provider when using permission checks or profile management features.
Enterprise widgets
Embeddable components for customer self-service — SSO, SCIM, and domain verification. Each widget accepts a portal token from the Wocha Console.
Tree-shakeable imports
Import components individually to reduce bundle size:
Learn more
- React SDK — headless hooks and components
- Next.js SDK — server-side OAuth BFF
- Component architecture
- Passkeys guide