72 modules in 6 groups. Each is built from the component kit, takes its data and copy as props, emits events, and
never fetches. Mobile first at 320px, themed with CSS variables in light, dark and forced
colors, and usable by keyboard and screen reader. Import from $lib/modules.
Every one is free and MIT-licensed. The demos below run on fake local data, so nothing you
type leaves this page.
Email and password sign-in with show/hide password, "keep me signed in", optional provider buttons (OAuth), and loading and error states.
Sign in
or use your email
Try the password wrong-password to see the error state.
Accessibility. A labelled form in a section named by its heading (level is a prop). Fields have real labels, autocomplete tokens (username, current-password) and aria-invalid + aria-describedby errors. A failed submit moves focus to an error summary whose links jump to each field; a server failure is announced as an alert. While loading the button sets aria-busy and ignores clicks without being disabled, so focus is not lost.
Accessibility. Each field shows its own error, tied with aria-invalid and aria-describedby; the password field also points at the strength meter and checklist. Strength is a word, and every requirement says met or not met in text, so nothing rests on colour. Failed submits focus an error summary; the terms label is a slot so it can hold links.
A strength meter and a checklist of password requirements, for any new-password field.
Password strength:Not entered yet
Your password needs:
○At least 8 characters(not met)
○A lowercase letter(not met)
○An uppercase letter(not met)
○A number(not met)
○A symbol(not met)
Accessibility. The bar is decorative; the strength word is a status region announced when it changes, and each requirement carries "(met)" or "(not met)" for screen readers. Link a password input to it with aria-describedby. Honours forced-colors.
Accessibility. A labelled section with a heading (level is a prop) that takes focus when you call focus() after a failed submit, so a screen reader reads it. Each link moves focus into its field. It renders nothing when there are no errors.
Three steps: request an email, enter the code (one-time-code input), set a new password, with a stepper and a resend countdown.
Reset your password
1Email(Current step)
2Code(Not started)
3New password(Not started)
Reset your password
Any email works. In a real app you would hold the step until the server answers (autoAdvance=false).
Accessibility. A Stepper marks the current step with aria-current. Each step change moves focus to that step's heading. The code is one labelled group of cells with one-time-code autocomplete. Resend is disabled with the time left in its text, and a polite status says when it is ready again. Errors are summarised and tied to their fields.
Avatar upload with preview, name, email and a bio with a character counter. Tracks what changed and offers Save and Discard.
Profile
Accessibility. The photo picker is a real button that opens the file dialog; picking a bad file shows its reason in text. Save and Discard are disabled until something changes, and a polite status says "You have unsaved changes" in words. The bio counter is announced politely. Errors are summarised and tied to their fields.
Signed-in devices with a "Current session" badge, last-active times, revoke one, and revoke all others behind a confirmation.
Active sessions
Devices where you are signed in.
Firefox on Linux Current session
Phoenix, USLast active:
Safari on iPhone
Portland, USLast active:
Chrome on Windows
Boston, USLast active:
Edge on Windows
Lewiston, USLast active:
Accessibility. A list of sessions; the current one carries a text badge, not only a colour. Each Revoke button is named for its device ("Revoke session on Firefox on Linux"). Times are real <time> elements. "Sign out of all other sessions" opens an alert dialog with Cancel focused. After a revoke, a status says which device was signed out and focus returns to the heading.
Delete the account behind a type-to-confirm step in an alert dialog.
Delete account
Permanently delete your account and everything in it. This cannot be undone.
Accessibility. The dialog is an alertdialog on the native <dialog>: focus is trapped, Cancel is focused first and Escape cancels. Pressing delete before the phrase matches keeps the dialog open, explains what to type in text and moves focus to the field. The button describes itself with the warning text.
Authenticator setup: QR code slot, copyable secret, verify the code, then recovery codes to copy or download.
Set up two-factor authentication
Scan the QR code
Open your authenticator app and scan this code.
QR code appears here
Or enter the key by hand
Setup key
JBSW Y3DP EHPK 3PXP
Enter the code
Save your recovery codes
Your recovery codes appear after you verify the code.
Accessibility. An ordered list of three parts, each with a heading. The secret is selectable text with a Copy button, for people who cannot scan. The code is a labelled one-time-code group with a text error. Copy and download results are announced in a status region. Finish stays disabled until "I have saved my recovery codes" is ticked.
Code
import { TwoFactorSetup } from '$lib/modules';
<TwoFactorSetup
secret={secret}
recoveryCodes={codes}
verified={ok}
error={failure}
on:verify={(e) => check(e.detail.code)}
on:complete={() => close()}
>
<img slot="qr" src={qrDataUrl} alt="QR code for your authenticator app" />
</TwoFactorSetup>
A menu of accounts or organisations with the current one marked, and an optional "add account" row.
Current account: Ada Lovelace
Accessibility. The ARIA menu-button pattern with radio items. Enter, Space or arrows open it on the current account; arrows, Home and End move and skip disabled accounts; a letter jumps to the next match; Escape closes and returns focus to the button. The current account has aria-checked, a check mark and the word "current" for screen readers.
CommentThread