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.
Appearance
Section titled “Appearance”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.
With shadcn/ui
Section titled “With shadcn/ui”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.
Localization
Section titled “Localization”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.
Variables
Section titled “Variables”Each option of variables sets one CSS custom property on the component’s root element.
| Option | CSS 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 |
Element keys
Section titled “Element keys”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.
| Key | Class |
|---|---|
root | zautha-root |
card | zautha-card |
header | zautha-header |
logo | zautha-logo |
title | zautha-title |
subtitle | zautha-subtitle |
form | zautha-form |
field | zautha-field |
label | zautha-label |
input | zautha-input |
select | zautha-select |
fieldError | zautha-field-error |
passwordToggle | zautha-password-toggle |
buttonPrimary | zautha-button-primary |
buttonSecondary | zautha-button-secondary |
buttonLink | zautha-button-link |
alternatives | zautha-alternatives |
socialButtons | zautha-social-buttons |
socialButton | zautha-social-button |
divider | zautha-divider |
providerIcon | zautha-provider-icon |
connectedAccount | zautha-connected-account |
alert | zautha-alert |
captcha | zautha-captcha |
identifier | zautha-identifier |
footer | zautha-footer |
footerAction | zautha-footer-action |
badge | zautha-badge |
avatar | zautha-avatar |
userButtonTrigger | zautha-user-button-trigger |
userButtonPopover | zautha-user-button-popover |
userButtonIdentity | zautha-user-button-identity |
userButtonAction | zautha-user-button-action |
impersonationBand | zautha-impersonation-band |
impersonationBandAction | zautha-impersonation-band-action |
modalBackdrop | zautha-modal-backdrop |
modal | zautha-modal |
userProfile | zautha-user-profile |
userProfileNav | zautha-user-profile-nav |
userProfileTab | zautha-user-profile-tab |
userProfilePanel | zautha-user-profile-panel |
userProfileTitle | zautha-user-profile-title |
profileSection | zautha-profile-section |
profileSectionTitle | zautha-profile-section-title |
profileSectionItem | zautha-profile-section-item |
profileSectionActions | zautha-profile-section-actions |
tag | zautha-tag |
buttonDanger | zautha-button-danger |
status | zautha-status |
scopeList | zautha-scope-list |
scope | zautha-scope |
consentRemembered | zautha-consent-remembered |
checkbox | zautha-checkbox |
qrCode | zautha-qr-code |
setupKey | zautha-setup-key |
backupCodes | zautha-backup-codes |
organizationList | zautha-organization-list |
organizationListItem | zautha-organization-list-item |
organizationProfile | zautha-organization-profile |
organizationProfileNav | zautha-organization-profile-nav |
organizationProfileTab | zautha-organization-profile-tab |
organizationProfilePanel | zautha-organization-profile-panel |
organizationProfileTitle | zautha-organization-profile-title |
organizationSwitcherTrigger | zautha-organization-switcher-trigger |
organizationSwitcherPopover | zautha-organization-switcher-popover |
organizationSwitcherIdentity | zautha-organization-switcher-identity |
organizationSwitcherAction | zautha-organization-switcher-action |
pagination | zautha-pagination |
Localization sections
Section titled “Localization sections”A localization object is a deep-partial of these top-level groups; every text it leaves out comes from the base
language.
localecommonsignInsocialButtonsssoCallbacksignUpsecondFactormfaSetuporganizationstaskChooseOrganizationcreateOrganizationorganizationSwitcherorganizationProfileuserButtonimpersonationBanduserProfilereverificationoauthConsentpassworderrors