Components
ElvixSignInButton

ElvixSignInButton

Drop-in 'Sign in with elvix' button. Four variants by three sizes by four shapes. The cheapest entry point: one line and you have a working sign-in flow.

filled · center (default)
outline · pill · center
white · center · large
filled · #2D5A3D · left · 15px · radius 4 · w-full
components/nav.tsx
"use client";
import { ElvixSignInButton } from "@elvix.is/sdk/react";
import { useRouter } from "next/navigation";
export function Nav() {
const router = useRouter();
return (
<ElvixSignInButton
variant="filled"
shape="pill"
size="md"
label="Continue with elvix"
onResult={(r) => {
if (!r.ok) return console.warn(r.error, r.message);
if (r.ok && r.token) {
const secure = location.protocol === "https:" ? "; secure" : "";
document.cookie = `elvix_token=${r.token}; path=/; samesite=lax${secure}`;
}
router.push(r.redirect ?? "/app");
}}
/>
);
}

Props

PropTypeRequiredDefaultDescription
labelstringoptional"Sign in with elvix"Button text. Override when you want a verb that matches your product copy.
variant"filled" | "outline" | "ghost" | "white"optional"filled"Visual treatment. Filled is the brand chord; white is for dark-mode heroes.
size"sm" | "md" | "lg"optional"md"Height + padding scale. Matches the host's button scale at md.
shape"square" | "rounded" | "pill" | "circle"optional"rounded"Corner radius. Pill for marketing surfaces, square for forms.
theme"auto" | "light" | "dark"optional"auto"Chord the button paints for. auto adopts the surrounding <ElvixProvider> resolved theme (system-aware), falling back to light. An explicit light / dark wins. Stops outline / ghost from painting white-on-white on a light surface.
mode"redirect" | "popup"optional"redirect"Where the sign-in flow renders. Redirect bounces to elvix.is and back; popup opens an in-frame window.
onResult(r: ElvixSignInResult) => voidoptionalTerminal callback. Same discriminated union as <ElvixSignIn>. Fires once per attempt with ok, token, redirect, error, message.
brandColorstringoptionalelvix lavender (#6c5ce7)Overrides the brand chord on variant="filled". Use the host's own brand.
onBrandColorstringoptional"#ffffff"Foreground (shield + label) on top of brandColor. Pick a WCAG-AA contrast pair.
align"left" | "center" | "right"optional"center"Content alignment inside the button. Combine with className="w-full" for a full-width hero CTA.
fontSizenumber | stringoptionalfrom size presetOverride the label font size. Number is treated as px; string is any CSS length.
borderRadiusnumber | stringoptionalfrom shape presetCustom corner radius. Wins over shape. Number is px; string is any CSS length ("8px", "50%").

Mount with no props and you still get a working flow (default chord, default verb, default factor stack from Console). The SDK handles the round-trip and lands the user back at your redirectAfterSignIn config.

Need the full surface (passkey + OTP + Google in one frame) inline on the page instead of behind a button? Reach for `ElvixSignInForm` (also exported as ElvixSignIn). The button is the in-nav / footer / hero affordance; the form is the surface itself — and it can present itself as a modal or drawer from its own trigger if you want the overlay without wiring one.

Related