Components
Shared web components used by framework SDKs.
@zitadel/components is a package of Lit web components: the login component <zitadel-login>, the sign-out component <zitadel-logout>, the session card <zitadel-session> and the atoms they are built from.
Framework SDKs wrap this package
Most applications should install the framework SDK first. Use this package directly when embedding the web components yourself.
Prerequisites
- A Zitadel project from
zitadel setup. Start the local runtime withnpx @zitadel/cli@latest start, then runnpx @zitadel/cli@latest setup --server localin your app's directory. See the Quickstart. - The project ID. Setup writes it to
.env.localasZITADEL_PROJECT_ID. - A same-origin proxy at
/__nextgenthat forwards to Zitadel. Setup configures one for local development, and a framework SDK provides it (SDK proxy).
Install the package
Install the components with @zitadel/api, which provides configureZitadel:
pnpm add @zitadel/components@latest @zitadel/api@latestComponents
<zitadel-login><zitadel-session>, the signed-in session card with sign-out<zitadel-logout>- atoms such as fields, buttons, alerts, icons, pills, and page shells
The login
The example runs <zitadel-login> against a mock of the flow API in your browser, so nothing you type leaves the page. Sign in with any email address and password, or switch purpose to sign up. previewState, the preview-state attribute, holds the step in one state and submits nothing, as the console's branding screen does.
<zitadel-login>
Loading the example…
Atoms
The login builds every step from atoms, and an ejected design's template uses them too (Customize the login design). The examples show the ones a template sets most, with their attributes.
<zl-button>
Loading the example…
<zl-field>
Loading the example…
<zl-alert>
Loading the example…
<zl-checkbox>
Loading the example…
<zl-pill>
Loading the example…
Use the login component
Configure the project once, then render the element. This is the package's own quick start. Setup writes the project ID to .env.local; replace proj_123 with it:
<script type="module">
import "@zitadel/components";
import { configureZitadel } from "@zitadel/api/config";
configureZitadel({ projectId: "proj_123", proxyPath: "/__nextgen" });
</script>
<zitadel-login variant="page" purpose="login"></zitadel-login>configureZitadel sets the project handle once, and <zitadel-login> picks it up. Set lang on the element to override the language.
How the login component runs
<zitadel-login> for login or registration flows.The components speak to the configured API base, usually the same-origin /__nextgen proxy path in generated apps.
In browser automation, the native controls live inside shadow roots. Prefer Playwright-style shadow-DOM-aware locators when available.
If your app renders on the server, mount the component on the client only, after hydration. Or give a raw <zitadel-login> element project-id and proxy-path as attributes. A component that starts before its configuration arrives shows an error instead of the flow.
Check that it works
Open the page. The login component renders the first step of the flow. If the error says <zitadel-login> requires a configured project, the component started before its configuration arrived: run configureZitadel first. Any other error comes from the flow API: check that the local runtime is running and that the proxy at /__nextgen forwards to it (SDK proxy).
See also
- SDKs: framework wrappers that bundle these components for you.
- SDK proxy: the same-origin
/__nextgen/*path the login component calls. @zitadel/componentssource.
Was this helpful?