Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Card examples · Standard

Login Card for React

A login card with email and password fields, a forgot-password link, a social sign-in button and a sign-up link.

Framework
UI library

A login form is often the first thing people see. This React card holds the whole form: an email field, a password field with a Forgot your password link, a Login button, a Login with Google button, and a sign-up link in the footer. Use it for a sign-in page, or put it in a dialog for a login that doesn't leave the page.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How are the labels tied to the fields?

Each label and input sit in a Field. FieldLabel points at its input with htmlFor, and the input has the matching id. Clicking a label focuses its field.

How do I submit the form?

Wrap the content in a form, make Login type="submit", and give the inputs a name and required. The demo has no form or handler, so the buttons do nothing yet.

Where is Forgot your password?

In a flex items-center justify-between row with the password label, above the input. It's a plain link: point its href at your reset page.

What are the two buttons?

Login, the default filled button, and Login with Google, variant="outline". Both are w-full. Add your provider's logo before the second label, or more outline buttons for more providers.

How wide is the login card?

Up to max-w-md with w-full, so it fills a phone screen and stops at 28rem. The fields and buttons stack with gap-4, and each label sits gap-2 above its input.