Skip to content

Appearance and localization

The prebuilt components of @zautha/ui take an appearance and a localization. Both are set once, where you create the SDK (new Zautha(publishableKey, { ui, appearance, localization }), or the same props on <ZauthaProvider> in @zautha/react and @zautha/nextjs), and apply to every component it mounts. Your instance’s branding from the dashboard (logo, primary colour, theme) sits underneath: what you set here wins.

import { Zautha } from "@zautha/js";
import { ui, type Appearance } from "@zautha/ui";
const appearance: Appearance = {
theme: "dark", // "auto" (default, follows prefers-color-scheme), "light", "dark" or a Theme object
variables: { colorPrimary: "#7c3aed", borderRadius: "0.75rem" },
elements: {
card: "shadow-lg", // a class name
buttonPrimary: { textTransform: "uppercase" }, // or a style object
},
options: { logoUrl: "/logo.svg", showOptionalFields: true },
};
const zautha = new Zautha("pk_test_…", { ui, appearance });

options.logoUrl replaces the instance’s logo; options.showOptionalFields shows the optional sign-up fields (first and last name, username) even when the instance does not require them. Styles are applied through the CSS object model and class names, so appearance works under a strict Content Security Policy.

shadcn from @zautha/ui/themes reads your shadcn/ui app’s own CSS variables (--primary, --background, --radius, …), so the components follow its palette, radius and dark mode:

import { shadcn } from "@zautha/ui/themes";
const appearance = { theme: shadcn };

A Theme is { name, light, dark? } with Variables for each mode, so you can ship your own the same way.

English (en) and Turkish (tr) come with the package. Pick one with locale; without it the browser’s language decides (Turkish for tr…, English otherwise). Override any text on top of the base language, in the same shape:

import { tr } from "@zautha/ui/localizations";
import type { LocalizationOverrides } from "@zautha/ui/localizations";
const localization: LocalizationOverrides = {
locale: "tr",
signIn: { start: { title: "Hesabına giriş yap" } },
errors: { form_password_incorrect: "Parola yanlış." },
};
console.log(tr.signIn.start.title); // the Turkish base text

{name} placeholders in a text are filled in by the component. The errors group has one text for every error code a component can show.

Each option of variables sets one CSS custom property on the component’s root element.

OptionCSS custom property
colorPrimary--zautha-color-primary
colorPrimaryForeground--zautha-color-primary-foreground
colorBackground--zautha-color-background
colorForeground--zautha-color-foreground
colorMutedForeground--zautha-color-muted-foreground
colorBorder--zautha-color-border
colorInputBackground--zautha-color-input-background
colorDanger--zautha-color-danger
colorRing--zautha-color-ring
borderRadius--zautha-radius
fontFamily--zautha-font-family
fontSize--zautha-font-size

Each key of elements takes a class name or a style object for that part of a component. The part always carries the class in the second column, which is stable across releases.

KeyClass
rootzautha-root
cardzautha-card
headerzautha-header
logozautha-logo
titlezautha-title
subtitlezautha-subtitle
formzautha-form
fieldzautha-field
labelzautha-label
inputzautha-input
selectzautha-select
fieldErrorzautha-field-error
passwordTogglezautha-password-toggle
buttonPrimaryzautha-button-primary
buttonSecondaryzautha-button-secondary
buttonLinkzautha-button-link
alternativeszautha-alternatives
socialButtonszautha-social-buttons
socialButtonzautha-social-button
dividerzautha-divider
providerIconzautha-provider-icon
connectedAccountzautha-connected-account
alertzautha-alert
captchazautha-captcha
identifierzautha-identifier
footerzautha-footer
footerActionzautha-footer-action
badgezautha-badge
avatarzautha-avatar
userButtonTriggerzautha-user-button-trigger
userButtonPopoverzautha-user-button-popover
userButtonIdentityzautha-user-button-identity
userButtonActionzautha-user-button-action
impersonationBandzautha-impersonation-band
impersonationBandActionzautha-impersonation-band-action
modalBackdropzautha-modal-backdrop
modalzautha-modal
userProfilezautha-user-profile
userProfileNavzautha-user-profile-nav
userProfileTabzautha-user-profile-tab
userProfilePanelzautha-user-profile-panel
userProfileTitlezautha-user-profile-title
profileSectionzautha-profile-section
profileSectionTitlezautha-profile-section-title
profileSectionItemzautha-profile-section-item
profileSectionActionszautha-profile-section-actions
tagzautha-tag
buttonDangerzautha-button-danger
statuszautha-status
scopeListzautha-scope-list
scopezautha-scope
consentRememberedzautha-consent-remembered
checkboxzautha-checkbox
qrCodezautha-qr-code
setupKeyzautha-setup-key
backupCodeszautha-backup-codes
organizationListzautha-organization-list
organizationListItemzautha-organization-list-item
organizationProfilezautha-organization-profile
organizationProfileNavzautha-organization-profile-nav
organizationProfileTabzautha-organization-profile-tab
organizationProfilePanelzautha-organization-profile-panel
organizationProfileTitlezautha-organization-profile-title
organizationSwitcherTriggerzautha-organization-switcher-trigger
organizationSwitcherPopoverzautha-organization-switcher-popover
organizationSwitcherIdentityzautha-organization-switcher-identity
organizationSwitcherActionzautha-organization-switcher-action
paginationzautha-pagination

A localization object is a deep-partial of these top-level groups; every text it leaves out comes from the base language.

  • locale
  • common
  • signIn
  • socialButtons
  • ssoCallback
  • signUp
  • secondFactor
  • mfaSetup
  • organizations
  • taskChooseOrganization
  • createOrganization
  • organizationSwitcher
  • organizationProfile
  • userButton
  • impersonationBand
  • userProfile
  • reverification
  • oauthConsent
  • password
  • errors