Skip to content

LM-04Components

Five prebuilt parts, styled by four values.

Sign-in, sign-up, the avatar menu, the organization switcher and the account page, each one live on this page. Change the theme, accent, radius and density on any bench and copy the listing that matches.

Title
Components
Doc. no.
LM-04
Rev.
04
Issued
Nov 2026
Sheet
4 of 4

1.0Parts list

Five parts. Each one drawn from your tokens.

Every part renders on your domain, inherits your fonts and takes four appearance values: theme, accent, radius and density. Set them once in the provider or per part, as the benches below do.

The prebuilt components, what each renders, its size and the revision it arrived in
No.PartWhat it rendersSizeSince
P-01<SignIn />Every method you switched on, in the order you chose: email code or magic link, passkey, social and SSO with organization-domain detection.14 kBRev. 1
P-02<SignUp />Registration with the same methods, a name field you can switch off, and the passkey offered first on devices that have one.15 kBRev. 1
P-03<UserButton />The avatar in your header, and the menu behind it: account, security, sign out. Arrow keys move through the menu, Escape closes it.4 kBRev. 2
P-04<OrganizationSwitcher />The active organization, the others the user belongs to, and a way to create a new one. Switching re-issues the session token with the new org_id.6 kBRev. 3
P-05<UserProfile />The account page you would otherwise build last and test least: name, email addresses, passkeys and the device list, with every action behind the right check.19 kBRev. 3
  • P-01

    What it renders
    Every method you switched on, in the order you chose: email code or magic link, passkey, social and SSO with organization-domain detection.
    Size
    14 kB
    Since
    Rev. 1
  • P-02

    What it renders
    Registration with the same methods, a name field you can switch off, and the passkey offered first on devices that have one.
    Size
    15 kB
    Since
    Rev. 1
  • P-03

    What it renders
    The avatar in your header, and the menu behind it: account, security, sign out. Arrow keys move through the menu, Escape closes it.
    Size
    4 kB
    Since
    Rev. 2
  • P-04

    What it renders
    The active organization, the others the user belongs to, and a way to create a new one. Switching re-issues the session token with the new org_id.
    Size
    6 kB
    Since
    Rev. 3
  • P-05

    What it renders
    The account page you would otherwise build last and test least: name, email addresses, passkeys and the device list, with every action behind the right check.
    Size
    19 kB
    Since
    Rev. 3

2.0Parts

Part no. P-01

2.1<SignIn />

Every method you switched on, in the order you chose: email code or magic link, passkey, social and SSO with organization-domain detection.

Size
14 kB gzipped
Methods
6
Locales
34
Since
Rev. 1

Sign in to Acme

or

Secured byLatch

Try it: the part is live.

P-01  SignIn.tsx
import { SignIn } from "@latch/nextjs";<SignIn  methods={["email_code", "passkey", "google"]}  appearance={{    theme: "light",    accent: "#0e7c52",    radius: 4,    density: "default",  }}/>
Fig. 2.1<SignIn /> on the bench. It is live: enter any email, then the code 424242.

Part no. P-02

2.2<SignUp />

Registration with the same methods, a name field you can switch off, and the passkey offered first on devices that have one.

Size
15 kB gzipped
Fields
Name, email
Verifies
Email, before the account
Since
Rev. 1

Create your Acme account

or

Secured byLatch

Try it: the part is live.

P-02  SignUp.tsx
import { SignUp } from "@latch/nextjs";<SignUp  fields={["name"]}  appearance={{    theme: "dark",    accent: "#8ea2ff",    radius: 10,    density: "default",  }}/>
Fig. 2.2<SignUp /> with the name field on. Same demo code: 424242.

Part no. P-03

2.3<UserButton />

The avatar in your header, and the menu behind it: account, security, sign out. Arrow keys move through the menu, Escape closes it.

Size
4 kB gzipped
Menu items
Yours + 3
Keyboard
Arrows, Esc
Since
Rev. 2
Acme

Projects

  • Checkout redesignprj_7f2k
  • Driver app 5.3prj_9m1x
  • Q4 invoicesprj_3c8q

Try it: the part is live.

P-03  UserButton.tsx
import { UserButton } from "@latch/nextjs";<UserButton  afterSignOutUrl="/"  appearance={{    theme: "light",    accent: "#14181b",    radius: 4,    density: "default",  }}/>
Fig. 2.3<UserButton /> in an app header. Open it, choose an item, sign out and back in.

Part no. P-04

2.4<OrganizationSwitcher />

The active organization, the others the user belongs to, and a way to create a new one. Switching re-issues the session token with the new org_id.

Size
6 kB gzipped
Personal account
Optional
Token re-issue
≈ 40 ms
Since
Rev. 3
  • Patients
  • Schedules
  • Members
  • Settings

Patients

Okapi Health · 7 members · you are Admin

org_id

org_okapi_health

Try it: the part is live.

P-04  OrganizationSwitcher.tsx
import { OrganizationSwitcher } from "@latch/nextjs";<OrganizationSwitcher  hidePersonal={false}  afterCreateUrl="/:slug"  appearance={{    theme: "light",    accent: "#c8371f",    radius: 0,    density: "compact",  }}/>
Fig. 2.4<OrganizationSwitcher /> at the top of a sidebar. Switch, or create an organization.

Part no. P-05

2.5<UserProfile />

The account page you would otherwise build last and test least: name, email addresses, passkeys and the device list, with every action behind the right check.

Size
19 kB gzipped
Pages
Account, Security
Step-up
For passkeys and email
Since
Rev. 3

Account

Profile

Ada Okaforusr_5k9m2c7q1x

Email addresses

  • ada@acme.devPrimary
  • ada.okafor@hey.exampleVerified

Try it: the part is live.

P-05  UserProfile.tsx
import { UserProfile } from "@latch/nextjs";<UserProfile  routing="hash"  appearance={{    theme: "light",    accent: "#0e7c52",    radius: 10,    density: "comfortable",  }}/>
Fig. 2.5<UserProfile /> mounted on /account. Edit the name, add or remove a passkey.

3.0Headless

Or keep your markup and use the hooks.

Every part is built on public hooks. Use them directly when a design calls for something the parts do not draw: the state machine, rate limits and error messages stay ours; the pixels are yours.

acme.dev/loginYour markup

useSignIn() returns

{  "status": "idle",  "error": null,  "attemptsLeft": 5,  "email": null,  "session": null}
Fig. 3.1A sign-in that looks nothing like <SignIn />, driven by useSignIn(). The state on the right is the hook's return value.
components/inline-sign-in.tsx
import { useSignIn } from "@latch/nextjs";export function InlineSignIn() {  const { status, error, sendCode, verify } = useSignIn();  if (status === "awaiting_code") {    return <CodeLine onComplete={verify} error={error} />;  }  return <EmailLine onSubmit={sendCode} />;}
  1. useSignIn() One hook per flow: useSignIn, useSignUp, useUser, useOrganization, useSessionList.

  2. status idle, sending, awaiting_code, verifying or complete. Render whatever you like for each.

  3. verify(code) Checks the code and starts the session. Wrong codes come back as error, with the attempts left.

  4. sendCode(email) Validates the address, applies the rate limits and sends the message from your domain.

4.0Accessibility

Accessibility, as a checklist you can run.

We test every part against WCAG 2.2 AA before a release, with a screen reader on three platforms and the keyboard alone. Do not take our word for it: each line says how to check it on this page, and you can tick it off.

Caution
Do not hide the parts' labels with CSS to match a mock-up. Password managers, autofill and screen readers find the fields by them, and sign-in is where a missing label locks people out.

Checked by you: 0 of 8

  1. Every control is reachable with Tab in visual order; menus open with Enter and move with the arrow keys.

    TryPress Tab into Fig. 2.3 and open the menu without the mouse.

  2. A 2 px ring in your accent, 2 px off the control, never clipped by a scroll container.

    TryTab through the toolbar of any bench and watch the ring follow.

  3. Labels are real <label> elements. Errors are tied to their field and read out once, politely.

    TrySubmit Fig. 2.1 with an empty email field.

  4. One real input with autocomplete=one-time-code behind the six slots, so no one retypes a code from memory.

    TryCopy 424242, then paste it into the first slot of Fig. 2.1.

  5. Text on the accent picks black or white for at least 4.5:1, and development builds warn when an accent falls under 3:1 against the surface.

    TrySwitch any bench to Ink, then to Dark.

  6. Controls are 36 px high at Compact and never under 24 px in any dimension.

    TrySet a bench to Compact and measure a button.

  7. Under prefers-reduced-motion the parts drop their transitions and the wrong-code shake.

    TryTurn on Reduce motion in your system settings and reload.

  8. Each part sets its own lang attribute and mirrors its layout for Arabic and Hebrew.

    TrySet locale="ar" on the provider in your app.

5.0Get started

Render a part today. Replace it with hooks whenever you like.

The parts and the hooks share one state machine, so swapping one for the other never changes how sign-in behaves. Both are in the same package, on every plan.

npm install @latch/nextjs

The parts, in numbers

Parts
5
Hooks
12
Largest part
19 kB gzipped
Locales
34
Plans
All