Login 1: card with SSO and magic link
Centered sign-in card: SSO and email-link buttons, an email and password form with remember me, a loading submit and an inline error.
The normal view. Pick a state to see what the block shows while it loads, is empty or fails.
// Ballmac UI: Login 1. https://ui.ballmac.com/blocks/login-1
"use client"
import * as React from "react"
import { KeyRound, Mail } from "lucide-react"
import { Button } from "@/components/ballmac/button"
import { Checkbox } from "@/components/ballmac/checkbox"
import { Input } from "@/components/ballmac/input"
import { Label } from "@/components/ballmac/label"
import { formPhase, type FormStateProps } from "@/lib/ballmac/use-resource"
import { cn } from "@/lib/utils"
type Login1Props = Omit<React.ComponentProps<"section">, "onSubmit"> & FormStateProps & {
/** The email to start with. */
defaultEmail?: string
/** Brand name or logo above the form. */
brand?: React.ReactNode
/** Heading. */
title?: string
/** Called with the form values. Show errors by passing `error`. */
onSubmit?: (values: { email: string; password: string; remember: boolean }) => void | Promise<void>
/** Called when "Continue with SSO" is pressed. Pass null to hide the button. */
onSso?: (() => void) | null
/** Called when "Email me a sign-in link" is pressed. Pass null to hide the button. */
onMagicLink?: (() => void) | null
/** Error message shown above the form. With `state="error"` it is the message too, unless `errorState.description` is given. */
error?: string
/** Where the "Forgot password?" link goes. */
forgotHref?: string
/** Where the "Create an account" link goes. */
signupHref?: string
}
function Login1({
brand = "Acme",
title = "Sign in to your account",
onSubmit,
onSso = () => {},
onMagicLink = () => {},
error,
forgotHref = "#",
signupHref = "#",
defaultEmail,
state: stateProp,
errorState,
className,
...props
}: Login1Props) {
const id = React.useId()
const [pendingInternal, setPending] = React.useState(false)
// a `state` prop drives the form; without it the form runs by itself. This form has no confirmation screen, so success looks like ready.
const phase = formPhase(stateProp)
const pending = phase === "sending" || pendingInternal
const message = phase === "error" ? (errorState?.description ?? error ?? "The email or password is not right. Check them and try again.") : phase === undefined ? error : undefined
return (
<section data-slot="login-1" className={cn("flex min-h-[640px] items-center justify-center px-4 py-16", className)} {...props}>
<div className="w-full max-w-sm">
<div className="text-center">
<div className="text-lg font-semibold tracking-tight">{brand}</div>
<h1 className="mt-6 text-2xl font-semibold tracking-tight">{title}</h1>
</div>
<div className="mt-8 rounded-2xl border bg-card p-6 shadow-[0_20px_60px_-40px_rgb(0_0_0/0.35)]">
<div className="grid gap-2">
{onSso && (
<Button variant="outline" onClick={onSso}>
<KeyRound /> Continue with SSO
</Button>
)}
{onMagicLink && (
<Button variant="outline" onClick={onMagicLink}>
<Mail /> Email me a sign-in link
</Button>
)}
</div>
<div className="my-6 flex items-center gap-3 text-xs text-muted-foreground" aria-hidden="true">
<span className="h-px flex-1 bg-border" />
or
<span className="h-px flex-1 bg-border" />
</div>
<form
className="grid gap-4"
aria-busy={pending || undefined}
onSubmit={async (e) => {
e.preventDefault()
const data = new FormData(e.currentTarget)
setPending(true)
try {
await onSubmit?.({ email: String(data.get("email")), password: String(data.get("password")), remember: data.get("remember") === "on" })
} finally {
setPending(false)
}
}}
>
{/* while the request is in flight nothing in the form can be changed or sent twice */}
<fieldset disabled={pending} className="contents">
{message && (
<p role="alert" className="rounded-md border border-destructive/40 px-3 py-2 text-sm text-destructive">
{message}
</p>
)}
<div className="grid gap-2">
<Label htmlFor={`${id}-email`}>Email</Label>
<Input id={`${id}-email`} name="email" type="email" autoComplete="email" defaultValue={defaultEmail} required aria-invalid={message ? true : undefined} />
</div>
<div className="grid gap-2">
<div className="flex items-center justify-between">
<Label htmlFor={`${id}-password`}>Password</Label>
<a href={forgotHref} className="text-sm text-muted-foreground underline-offset-4 hover:text-foreground hover:underline">
Forgot password?
</a>
</div>
<Input id={`${id}-password`} name="password" type="password" autoComplete="current-password" required aria-invalid={message ? true : undefined} />
</div>
<div className="flex items-center gap-2">
<Checkbox id={`${id}-remember`} name="remember" />
<Label htmlFor={`${id}-remember`} className="font-normal">
Keep me signed in
</Label>
</div>
<Button type="submit" loading={pending} className="mt-2 w-full">
Sign in
</Button>
</fieldset>
</form>
</div>
<p className="mt-6 text-center text-sm text-muted-foreground">
New here?{" "}
<a href={signupHref} className="text-foreground underline underline-offset-4">
Create an account
</a>
</p>
</div>
</section>
)
}
export { Login1, type Login1Props }Installation
$ pnpm dlx shadcn@latest add @ballmac/login-1Install the dependencies.
$ pnpm add lucide-reactAdd the Ballmac items it builds on.
$ pnpm dlx shadcn@latest add @ballmac/button @ballmac/checkbox @ballmac/input @ballmac/label @ballmac/use-resourceCopy the source into your project.
components/ballmac/blocks/login-1/login-1.tsx// Ballmac UI: Login 1. https://ui.ballmac.com/blocks/login-1 "use client" import * as React from "react" import { KeyRound, Mail } from "lucide-react" import { Button } from "@/components/ballmac/button" import { Checkbox } from "@/components/ballmac/checkbox" import { Input } from "@/components/ballmac/input" import { Label } from "@/components/ballmac/label" import { formPhase, type FormStateProps } from "@/lib/ballmac/use-resource" import { cn } from "@/lib/utils" type Login1Props = Omit<React.ComponentProps<"section">, "onSubmit"> & FormStateProps & { /** The email to start with. */ defaultEmail?: string /** Brand name or logo above the form. */ brand?: React.ReactNode /** Heading. */ title?: string /** Called with the form values. Show errors by passing `error`. */ onSubmit?: (values: { email: string; password: string; remember: boolean }) => void | Promise<void> /** Called when "Continue with SSO" is pressed. Pass null to hide the button. */ onSso?: (() => void) | null /** Called when "Email me a sign-in link" is pressed. Pass null to hide the button. */ onMagicLink?: (() => void) | null /** Error message shown above the form. With `state="error"` it is the message too, unless `errorState.description` is given. */ error?: string /** Where the "Forgot password?" link goes. */ forgotHref?: string /** Where the "Create an account" link goes. */ signupHref?: string } function Login1({ brand = "Acme", title = "Sign in to your account", onSubmit, onSso = () => {}, onMagicLink = () => {}, error, forgotHref = "#", signupHref = "#", defaultEmail, state: stateProp, errorState, className, ...props }: Login1Props) { const id = React.useId() const [pendingInternal, setPending] = React.useState(false) // a `state` prop drives the form; without it the form runs by itself. This form has no confirmation screen, so success looks like ready. const phase = formPhase(stateProp) const pending = phase === "sending" || pendingInternal const message = phase === "error" ? (errorState?.description ?? error ?? "The email or password is not right. Check them and try again.") : phase === undefined ? error : undefined return ( <section data-slot="login-1" className={cn("flex min-h-[640px] items-center justify-center px-4 py-16", className)} {...props}> <div className="w-full max-w-sm"> <div className="text-center"> <div className="text-lg font-semibold tracking-tight">{brand}</div> <h1 className="mt-6 text-2xl font-semibold tracking-tight">{title}</h1> </div> <div className="mt-8 rounded-2xl border bg-card p-6 shadow-[0_20px_60px_-40px_rgb(0_0_0/0.35)]"> <div className="grid gap-2"> {onSso && ( <Button variant="outline" onClick={onSso}> <KeyRound /> Continue with SSO </Button> )} {onMagicLink && ( <Button variant="outline" onClick={onMagicLink}> <Mail /> Email me a sign-in link </Button> )} </div> <div className="my-6 flex items-center gap-3 text-xs text-muted-foreground" aria-hidden="true"> <span className="h-px flex-1 bg-border" /> or <span className="h-px flex-1 bg-border" /> </div> <form className="grid gap-4" aria-busy={pending || undefined} onSubmit={async (e) => { e.preventDefault() const data = new FormData(e.currentTarget) setPending(true) try { await onSubmit?.({ email: String(data.get("email")), password: String(data.get("password")), remember: data.get("remember") === "on" }) } finally { setPending(false) } }} > {/* while the request is in flight nothing in the form can be changed or sent twice */} <fieldset disabled={pending} className="contents"> {message && ( <p role="alert" className="rounded-md border border-destructive/40 px-3 py-2 text-sm text-destructive"> {message} </p> )} <div className="grid gap-2"> <Label htmlFor={`${id}-email`}>Email</Label> <Input id={`${id}-email`} name="email" type="email" autoComplete="email" defaultValue={defaultEmail} required aria-invalid={message ? true : undefined} /> </div> <div className="grid gap-2"> <div className="flex items-center justify-between"> <Label htmlFor={`${id}-password`}>Password</Label> <a href={forgotHref} className="text-sm text-muted-foreground underline-offset-4 hover:text-foreground hover:underline"> Forgot password? </a> </div> <Input id={`${id}-password`} name="password" type="password" autoComplete="current-password" required aria-invalid={message ? true : undefined} /> </div> <div className="flex items-center gap-2"> <Checkbox id={`${id}-remember`} name="remember" /> <Label htmlFor={`${id}-remember`} className="font-normal"> Keep me signed in </Label> </div> <Button type="submit" loading={pending} className="mt-2 w-full"> Sign in </Button> </fieldset> </form> </div> <p className="mt-6 text-center text-sm text-muted-foreground"> New here?{" "} <a href={signupHref} className="text-foreground underline underline-offset-4"> Create an account </a> </p> </div> </section> ) } export { Login1, type Login1Props }Update the import paths to match your project setup.
Usage
import { Login1 } from "@/components/ballmac/blocks/login-1/login-1"
export default function Login1Demo() {
return <Login1 />
}States
Pass state and the block does the rest: skeletons that match its layout, a clear empty message, an error you can retry, and announcements for screen readers.
Signing in
Every field and button is disabled while the request is in flight, the button shows a spinner, and the form is marked busy.
state="submitting"Wrong password
An alert above the form with the message (errorState.description to change it); the fields stay editable so it can be fixed.
state="error"
Quality scorecard
Every applicable check passes
Measured in Chromium 153.0.8010.12 on October 19, 2026, on version 1.1.0, across 3 examples.
Passed: Accessibility scan
No serious or critical issues in light and dark, on a phone and a desktop (axe-core 4.13.0, WCAG 2.1 AA and best-practice rules).
Passed: Small screens
No sideways scrolling at 360, 390 or 1280 px wide.
Passed: Reduced motion
Every decorative animation stops. A loading spinner keeps turning on purpose, because it is the only sign that work is in progress.
Passed: Right to left
Mirrors correctly in Arabic, Hebrew, Persian and Urdu layouts (7% of elements off the mirror, limit 15%).
Passed: Clean console
No console errors or React hydration errors while loading.
Passed: Keyboard
20 tab stops, each showing a visible change when it takes focus.
Passed: Loading, empty and error
Ships submitting, error states, each with an example.
Passed: Automated tests
Covered by form-states.test.tsx.
For information: Footprint
2.0 KB of source (gzip) in 1 file. Installs lucide-react.
Automated checks find a subset of problems and do not replace testing with a screen reader and a keyboard in your own app. What they miss.
Dependencies
- npm
- lucide-react
Use with AI
A sign-in screen. Wire onSubmit to your auth (it can be async; the button shows a spinner), pass error to show failures, and onSso/onMagicLink for passwordless options. With the shadcn MCP server set up (guide), ask your agent:
Add the Ballmac UI Login 1: card with SSO and magic link (@ballmac/login-1) to this project with the shadcn MCP, then use it where it fits.
Use it for
- App sign-in pages
- Admin or dashboard login
Not for
- Sign-up with many fields (build a form from input, label and checkbox)
Registry JSON: https://ui.ballmac.com/r/login-1.json
Free to use in personal and commercial projects.
More authentication blocks
Forgot Password 1: request, resend and reset
The whole password-recovery flow in one card: request a link, check-your-email with a resend countdown, choose a new password with confirmation and strength, and a success screen. Focus moves to each new heading.
Auth Pro 1: sign in with email and providers
A calm sign-in card with provider buttons, email and password with a show button, remember me, field errors that take focus and a server error banner.
Auth Pro 2: sign up with password strength
Name, email and a password with a four-step strength meter and a live checklist, plus a required terms checkbox and clear errors.
Auth Pro 3: one-time code verification
Six digit boxes backed by one real input, so paste and autofill work. Checks on the last digit, shows a wrong-code state and offers a resend with a countdown.
Ballmac UI Pro
Need the whole screen, not one piece?
311 premium blocks (dashboards, settings, calendars, mail, shops, onboarding), a private shadcn registry and Figma tokens. Blocks that show data come with loading, empty and error states built in.
Not ready? Try three Pro blocks free
Leave your email and the blocks appear right here, ready to copy. Yours to use in any project.