Simulates prefers-reduced-motion for the demo. Off follows your system setting.
Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.
A passkey sign-in button with a fingerprint that scans while it waits and draws into a check once verified.
npx shadcn@latest add ikislay/pixel-ui/passkey-buttonimport { PasskeyButton } from "@/components/ui/passkey-button";import { startAuthentication } from "@simplewebauthn/browser";export default function Demo() {return (<PasskeyButtononVerify={async () => {const options = await fetch("/api/passkey/options").then((r) => r.json());const response = await startAuthentication({ optionsJSON: options });const res = await fetch("/api/passkey/verify", {method: "POST",body: JSON.stringify(response),});if (!res.ok) throw new Error("That passkey wasn't recognized.");}}
1// Loading…
Options you can pass to customize this component.
onVerify() => unknownRuns on click. Return a promise to scan until it settles: resolve to verify, throw an Error to show its message. A plain return verifies at once.
statusidlescanningverifiederrorControls the state yourself. Leave it out and onVerify drives it.
onStatusChange(status) => voidCalled whenever the state changes.
labelsPartial<Record<status, string>>Overrides the text per state. Defaults are "Sign in with passkey", "Verifying passkey", "Verified" and "Try again".
errorMessageReactNodeShown under the button on error, in place of the thrown error's message.
variantsurfaceprimaryoutlineThe button's surface.
sizedefaultlg46px or 54px tall.
fullWidthbooleanStretches the button to fill its container.
resetAfternumberMilliseconds after Verified to return to idle. 0 keeps it verified until clicked.
classNamestringClasses applied to the root element.
Simulates prefers-reduced-motion for the demo. Off follows your system setting.
Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.
1
A passkey sign-in button with a fingerprint that scans while it waits and draws into a check once verified.
npx shadcn@latest add ikislay/pixel-ui/passkey-buttonimport { PasskeyButton } from "@/components/ui/passkey-button";import { startAuthentication } from "@simplewebauthn/browser";export default function Demo() {return (<PasskeyButtononVerify={async () => {const options = await fetch("/api/passkey/options").then((r) => r.json());const response = await startAuthentication({ optionsJSON: options });const res = await fetch("/api/passkey/verify", {method: "POST",body: JSON.stringify(response),});if (!res.ok) throw new Error("That passkey wasn't recognized.");}}
1// Loading…
Options you can pass to customize this component.
onVerify() => unknownRuns on click. Return a promise to scan until it settles: resolve to verify, throw an Error to show its message. A plain return verifies at once.
statusidlescanningverifiederrorControls the state yourself. Leave it out and onVerify drives it.
onStatusChange(status) => voidCalled whenever the state changes.
labelsPartial<Record<status, string>>Overrides the text per state. Defaults are "Sign in with passkey", "Verifying passkey", "Verified" and "Try again".
errorMessageReactNodeShown under the button on error, in place of the thrown error's message.
variantsurfaceprimaryoutlineThe button's surface.
sizedefaultlg46px or 54px tall.
fullWidthbooleanStretches the button to fill its container.
resetAfternumberMilliseconds after Verified to return to idle. 0 keeps it verified until clicked.
classNamestringClasses applied to the root element.