Auth Card
The centered card for sign in, sign up, forgot password and verify code screens: a logo, a title, your form, other ways to sign in and links underneath.
A ready-made piece, built from the library's own parts.
A block puts several components together into something you would otherwise assemble by hand. It never fetches data: you give it the data, or answer its callbacks. It is copied into your project like any component, with the parts it uses, so you can change anything.
Sign in
Sign up
Forgot password
Verify code
Split with image
Muted background
Centered minimal
With social buttons
Reset password
Installation
npx rdloom add auth-cardCopies the source into src/components/rdloom. Edit it freely: rdloom upgrade merges later versions into your changes.
Use another registry client
npx shadcn@latest add https://rdloom.vimalbhatt.com/r/auth-card.jsonWorks, but without upgrade tracking.
Usage
import { AuthCard, Button, ErrorSummary, Form, FormSubmitButton, FormTextField } from "@rdloom/react";
<div className="h-full w-full">
<AuthCard
brand={<span className="text-lg font-semibold tracking-tight text-[var(--rd-color-text-default)]">rdloom</span>}
title="Sign in to your account"
description="Welcome back. Enter your details to continue."
socialProviders={
<Button variant="secondary" className="w-full">
Continue with single sign-on
</Button>
}
footer={
<>
<a href="/forgot-password" className={link}>
Forgot your password?
</a>
<p>
New here?{" "}
<a href="/sign-up" className={link}>
Create an account
</a>
</p>
</>
}
>
<Form
className="flex flex-col gap-4"
defaultValues={{ email: "", password: "" }}
onSubmit={async (values) => {
await new Promise((resolve) => setTimeout(resolve, 600));
return values.password === "wrong" ? { formError: "The email or password is not right. Check them and try again." } : undefined;
}}
>
<ErrorSummary title="We could not sign you in" />
<FormTextField
name="email"
label="Email"
type="email"
autoComplete="email"
placeholder="you@company.com"
isRequired
validate={(v) => (v && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v) ? "Enter an email address like name@company.com." : null)}
/>
<FormTextField name="password" label="Password" type="password" autoComplete="current-password" isRequired />
<FormSubmitButton className="w-full">Sign in</FormSubmitButton>
</Form>
</AuthCard>
</div>API Reference
Defined by the spec. Components also accept the props of the React Aria component they wrap.
| Prop | Type | Default |
|---|---|---|
titlerequiredThe screen's title, shown as an h1, e.g. "Sign in to your account". | node | none |
headingLevelHeading level of the title, 1 to 6. | number | 1 |
descriptionOne sentence under the title. | node | none |
brandYour logo or name, shown above the title. | node | none |
childrenThe form: Form, fields and a submit button. | node | none |
socialProvidersButtons for signing in another way. They are set under an "or continue with" line. | node | none |
socialLabelThe text of the line above the social providers. | string | "or continue with" |
footerLinks under the card content, such as "Forgot your password?" or "Create an account". | node | none |
illustrationAn image or panel for the side of the card. Shown from large screens up; hidden on a phone. | node | none |
sizeWidth of the form column: 22rem, 26rem or 32rem. | "sm" | "md" | "lg" | "md" |
classNamesExtra class names for single parts, so you can restyle one part without editing the file. Keys: root, card, brand, header, title, description, body, socialProviders, footer, illustration. | Partial<Record<"root" | "card" | "brand" | "header" | "title" | "description" | "body" | "socialProviders" | "footer" | "illustration", string>> | none |
Accessibility
Role none, WCAG 2.2 AA. Tested with axe and keyboard tests; screen reader checks are in the audit checklist.
Keyboard
- Tab: moves through the form fields, the submit button, the providers, then the footer links
Screen readers announce
- "Sign in to your account, heading level 1"
- "or continue with, separator"
What your code must do
- The title is the page's h1
- The "or continue with" line is a separator with a text label, read once
- The illustration is decorative and hidden from screen readers
- The card holds the form only; error summary, labels and messages come from the Form components you put inside
Block contract
- Data
- Text for the title and description, and the form as children.
- Data states
- ready
- Permissions
- None yet
- Events
- None
- You can replace
- classNames for each part; brand, footer, socialProviders and illustration slots; the form you pass as children
Guidelines
Use it when
- Sign in, sign up, forgot password, reset password, verify code
Avoid it when
- A settings form inside the app: use a normal page
Don't
- Putting the account's real credentials in examples or tests
- Hiding the error summary: a failed submit must be explained
Design tokens
The semantic tokens this component uses. Change them once and every component follows; see Design tokens.
--rd-color-surface-default--rd-color-surface-subtle--rd-color-border-default--rd-color-text-default--rd-color-text-muted--rd-radius-overlay