shadcn.io is not affiliated with official shadcn/ui
Centered Sign In Login Block for React
A full-height sign-in page for a team chat app: the product's mark, Google and GitHub rows with lettermark tiles, an or rule, email and password checked on submit, and one Sign in button with a simulated wait and its result.
Installation
Overview
Give your app a sign-in page that fills the screen, with this centered login block for React with Base UI. It's the sign-in of Parleyboard, a team chat for small crews: the page's two side rails run its full height, and one band crosses the screen between two rules with a plus mark where each meets a rail, holding the form a little above the middle. The product's mark sits over the heading and one sentence, then two outline Buttons continue with Google or GitHub, each with a two-letter tile in place of a logo, split from the form by an "or" rule. A Field holds the email Input, another the Password Input with its show and hide toggle and a "Forgot password?" link, and the Shine Button signs in, the only colored control. Sending the form checks both fields, writes each problem under its field and moves focus to the first one; a good press shows a spinner for a moment, then puts the result in the form's own space and moves focus to it. Every result has a way back, and the page never changes height. It's built from Field, Input, Password Input, Button, Shine Button and Guides, with a CSS entrance only. For any app's sign-in screen.
FAQ
What happens when I sign in, and what stays in the page?
Nothing leaves the page. Sign in waits under a spinner for less than a second, then shows "You're signed in" with the address you typed, and a polite status message says nothing was sent; Sign out brings the form back with your email still filled in. Pressing Continue with Google or GitHub shows where a real one would send you, with a way back. To wire it for real, post the email and password to your auth endpoint where the code says so (a server action or your auth library's sign-in call), keep the busy state until it answers, then redirect, or show its error under the field it concerns. Point each provider row at your OAuth or OpenID Connect redirect.
Why is the Sign in button never disabled?
A disabled button can't explain itself, and keyboard users can't reach it. Here it stays enabled: pressing it with an empty or malformed email, or no password, marks those fields invalid, writes one sentence under each and moves focus to the first, which reads its problem out. Typing clears that field's problem. The browser's own validation bubbles are turned off with noValidate, so the messages look the same in every browser. Each field keeps a line for its problem even when there is none, so a problem never pushes the page.
Do password managers fill it in?
Yes. The email field is type="email" with autocomplete="username", and the password field autocomplete="current-password", which is what browsers and password managers look for on a sign-in form. Both fields have real labels and names. For a sign-up page, use new-password on the password so managers offer to generate one.
Why two-letter tiles instead of the Google and GitHub logos?
A brand's logo comes with its own usage rules, so the block ships a neutral tile with two letters (Go, Gh) and says the provider's name in the button. Drop in the official marks from each provider's brand guidelines where the code marks the icon slot. To add Apple or Microsoft, add a row to PROVIDERS with its name, a slug and its two letters (Ap, Ms).
Is it usable with a keyboard and a screen reader?
Tab runs through the provider rows, the email, Forgot password, the password, its show and hide toggle and Sign in; Enter in either field signs in. The toggle is a named button, pressed while the password shows, and Enter or Space flips it. The heading names the form, each problem is tied to its field, and after signing in focus moves to the result's heading while a polite status message says what happened, so screen reader users hear the outcome.
How does it fill the screen?
The page's column is at least the screen's height (min-h-svh, which doesn't jump when a phone's toolbars hide) and centers the band with a little more room below than above, so the form sits where the eye lands. It follows your theme in light and dark, and on a phone the band is tighter so the Sign in button stays on the first screen.
Related
- Pro
Minimal Sign In Login
Centered formA bare sign-in page for a plain-text notes app: a heading, one sentence, an email and a password written on a hairline and one Sign in button, set at the start of the page with no card, providers or footer.
- Pro
Social Buttons Login
SSO and providersA full-height provider-first sign-in page for a photo-sharing app: four hairline rows for Google, GitHub, Apple and Microsoft with a Last used badge that moves, and an email form that opens in place.
- Pro
Split Product Sketch Login
Split with a panelA split sign-in page for a grocery delivery service: the form at the end beside a drawn sketch of the product (a basket, a delivery slot and a total in an inset frame), with Remember me and a simulated sign-in.
- Pro
Split Signup Form Hero
Signup and waitlistA split hero with a sign-up form on the page: copy and ticks at the start, and a card in card form at the end with a work email, a password and a Shine Button that shows a spinner, then a confirmation.
- Pro
Auth Buttons Navbar
Accounts and scopesA navbar with a working sign-in flow: Sign in and Sign up open a small dialog, continuing swaps the buttons for an avatar menu and Sign out swaps them back, with the same two states in the phone sheet.
- Pro
Alert Banner Login
Centered formA full-height sign-in page for a database host with a maintenance notice pinned above the form: a quiet alert with the window in UTC, a Details popover and a Dismiss that never moves the form.