Passkin

Web components: the account components for any framework

Status: built (2026-10-05). Tests: packages/elements/tests/elements.test.ts, packages/client (the core), packages/react/tests (the React side of the same core).

The React components (ACCOUNT.md) have a twin that needs no framework: plain custom elements that work in Vue, Svelte, Angular, Solid, Astro, Alpine, HTMX, a static page — anything that can put a tag in a document. They show the same things in the same words (English, Arabic — right to left included — and Spanish), call the same end-user API, and — like the React ones — never hold a token: the browser talks to your server's routes (FRAMEWORKS.md, @passkin/nextjs, @passkin/server), which add it.

<script type="module" src="https://unpkg.com/@passkin/elements"></script>   <!-- or: npm i @passkin/elements, then import "@passkin/elements" -->

<passkin-signed-out><passkin-sign-in-button>Sign in</passkin-sign-in-button></passkin-signed-out>
<passkin-signed-in><passkin-user-button></passkin-user-button></passkin-signed-in>

(For a plain <script> tag use dist/passkin-elements.global.js — 54 KB, everything inside, global PasskinElements.)

Element What it is Attributes
<passkin-signed-in> / <passkin-signed-out> Show what is inside only for that state — and neither, until the server has answered
<passkin-sign-in-button> Sends the browser to your hosted sign-in and back; the label is its content return-to, prompt (login, select_account), login-hint, connection (google, github, email…: straight there), button-text (continue_with, signin_with, signup_with, by_screen — what the provider buttons say, SOCIAL.md), and for a step-up (STEP-UP.md) acr-values="mfa", max-age (seconds)
<passkin-sign-in-buttons> A button per provider the project offers now (Google, GitHub, LinkedIn…), worded as chosen on the Methods page, each straight there — a provider switched on in the dashboard appears within seconds mode (signin, signup), return-to, others="false" (leave out the button to Passkin's page for email, password and passkeys), lang
<passkin-sign-up-button> The same page, open on «Create your account»; the label is its content (default "Sign up") return-to, login-hint, connection, button-text
<passkin-sign-out-button> Signs out of the site and of Passkin return-to
<passkin-user-button> The person's avatar with a menu: who they are, Manage account (the profile in a dialog), sign out. Escape or a click outside closes it return-to, manage="false"
<passkin-user-profile> Profile, how they sign in (as facts — credentials are managed at their Passkin ID), their devices (end one, end the others), deleting the account here default-tab (profile, security, devices, account)
<passkin-api-keys> The keys a person, or an organization they administer, makes to call your API; a key is shown once (API-KEYS.md) organization
<passkin-connected-accounts> The accounts a person connected to your product — never a token (VAULT.md) return-to
<passkin-organization-switcher> Who the session acts as: the active organization, a menu to change it (the tokens are replaced on the server), Manage (the profile in a dialog) and Create organization where the product allows it
<passkin-organization-profile> An organization's settings (rename, leave, delete by typing its name), members (change a role, remove), invitations (several addresses at once, revoke) and single sign-on / domains / directory sync / audit log as a secure Admin Portal link — each tab only as far as the person's role goes (ORGANIZATIONS.md) organization (an id; default: the active one)
<passkin-create-organization> A name and a button

Every element takes auth-path (where your server mounted the routes, default /api/auth) and lang (en or ar; otherwise the page's <html lang>).

Per framework

It is one tag in every framework. Two things to know: the elements need your server's /api/auth/* routes to exist, and a tag's content (Sign in) is the label.

<!-- Vue: tell it the elements are custom (vite: vue({ template: { compilerOptions: { isCustomElement: (t) => t.startsWith("passkin-") } } })) -->
<script setup>import "@passkin/elements";</script>
<template><passkin-user-button return-to="/" /></template>
<!-- Svelte / SvelteKit -->
<script>import "@passkin/elements";</script>
<passkin-signed-in><passkin-user-profile default-tab="devices"></passkin-user-profile></passkin-signed-in>
// Angular: add CUSTOM_ELEMENTS_SCHEMA to the module or standalone component, then import "@passkin/elements" once (main.ts).
---
// Astro: a client-side script; the elements hydrate themselves.
---
<script>import "@passkin/elements";</script>
<passkin-sign-in-button return-to="/app">Sign in</passkin-sign-in-button>

Configuring them

import { configure, clientFor } from "@passkin/elements";

// Before the elements connect (replaces any earlier call):
configure({
  authPath: "/auth",                 // where your routes are mounted
  initialUser: serverRenderedUser,   // the user your server already knows: first paint is right and no request is made
  api: myTransport                   // how `/v1/me/…` is reached, when it is not `${authPath}/api/…` (a single-page app with its own proxy)
});

// The shared client, for your own code: who is signed in, and the same API the elements use.
const passkin = clientFor();
passkin.subscribe((s) => render(s.user));   // { user, organization, isLoaded, isSignedIn }
await passkin.api("/me");
passkin.signIn({ returnTo: "/dashboard" });

Every element with the same auth-path shares one client, so a page full of them asks the server for the session once. @passkin/client is that client on its own — it is also what @passkin/react is built on, and it is all a Vue or Svelte app needs to build its own components: subscribe is the entire reactivity contract.

Events

What a person does in the organization elements is announced with DOM events that bubble and cross the shadow root, so a page listens on document (or any ancestor) — detail.organization is the organization's id, or "" for none:

document.addEventListener("passkin:organization-switched", (e) => reloadOrders(e.detail.organization));
document.addEventListener("passkin:organization-created", (e) => clientFor().switchOrganization(e.detail.organization)); // the switcher already does this for its own form
document.addEventListener("passkin:organization-left", (e) => redirectHome());   // left, removed, or deleted; the session is back to "no organization" first

Styling

Elements use a shadow root, so your page's CSS does not leak in and theirs does not leak out; the look is set with CSS variables that cross the boundary:

passkin-user-profile, passkin-api-keys, passkin-organization-profile { --pk-accent: #0a7; --pk-radius: 8px; --pk-fg: #111; --pk-bg: #fff; --pk-muted: #667; --pk-line: #ddd; --pk-danger: #c00; --pk-ok: #070; }

Buttons and the avatar expose part="button" and part="avatar" for ::part(). The elements write everything — a name, a picture address, an API key's label — as text or an attribute value and never as markup, so there is nothing in them to inject into; they load no stylesheet or font and make no request but to your own server.

Not built

A <passkin-sign-in> card (use the button: sign-in itself is on your project's hosted page, so your site never handles a password or a code); Vue/Svelte-specific wrappers with typed props (the tags work as they are); a theme editor; passkin add; server-side rendering of the elements (they draw in the browser; initialUser makes the first paint right).

Ready to try it?

Create a project — the dashboard fills these snippets in with your own keys.

Open the dashboard