shadcn.io is not affiliated with official shadcn/ui
Tabbed Sign In And Sign Up Login Block for React
One column for a writer and editor marketplace with Sign in and Create account as two tabs, each with a Google row and its own fields, the email carried between them and a card that never changes height.
Installation
Overview
Put signing in and signing up in the same place, with this tabbed auth login block for React with Base UI. It's the front door of Quillmatch, a marketplace for writers and editors: the page's side rails run the full height of the screen and one band crosses it between two rules, holding a centred column with the product's mark, a heading and the catalog's Tabs, "Sign in" and "Create account". Each panel has a Google row (a two-letter tile and the name, never a logo), an "or" rule and its own fields: the sign-in has the email, a Password Input and a "Keep me signed in" Checkbox; the sign-up asks for a name, the email and a password with an eight-character hint. The email typed on one tab is waiting on the other. The panels differ in height, so an unseen copy of both sizes the card and switching never moves the page. Each form has its own Shine Button, the only colored control. It's built from Tabs, Field, Input, Password Input, Checkbox, Button, Shine Button and Guides, with CSS transitions only. For marketplaces and apps where one visit decides between signing in and joining.
FAQ
What stays in the page, and what does the Google row do?
Everything stays in the page. Sending either form waits less than a second and shows what a real product would do next in the card's own space, with a polite status message saying nothing was sent. The Google row opens nothing: it says where a real one would send the visitor and offers a way back that returns focus to the row. Its tile is two typed letters, a placeholder for a logo you have the right to use under the provider's brand terms.
What carries over when I switch tabs?
The email only, because a visitor who has typed it once shouldn't type it again. Passwords are kept apart, so a password for signing in never becomes the new one for sign-up, and the name belongs to sign-up. The problems of one tab aren't shown on the other, and a polite message says which tab is showing and that the email is kept.
How does the card keep its height when the two panels differ?
An unseen copy of both panels sits in the same grid cell as the real one, so the cell is as tall as the taller panel whichever tab is showing. The copy is hidden from assistive technology, out of the tab order and uses its own ids, so nothing is announced twice. The page is centered, so any change in height would move the heading.
How do the tabs work with a keyboard?
Tab reaches the selected tab, then the arrow keys move between "Sign in" and "Create account" and show the panel, and the panel's own fields follow in the tab order. Screen readers hear a tab list with two tabs and a labelled panel for each.
Is the hidden panel still in the page?
No: only the panel of the selected tab is rendered, apart from the unseen copy that holds the height. What you typed lives in the block's own state, so it's still there when you switch back, and the real fields are rebuilt each time.
Why are the buttons never disabled?
A disabled button can't say why, and keyboard users can't reach it. Pressing Sign in or Create account early marks the fields at fault, writes one sentence under each and moves focus to the first, and every field keeps a line for its problem even when there is none, so nothing moves when one appears.
Related
- @Pro
Create Account Handle Check Login
Sign-up and consentA sign-up page for a community forum in two columns of fields: a handle with an at sign that checks itself against a typed taken list and offers three tries as buttons, then the email, a password with an eight-character hint and Create account.
- Pro
Centered Sign In Login
Centered formA 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.
- 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
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
Team Invite Acceptance Login
Workspaces and rolesAn invitation page for a shared team calendar: the workspace tile, Maya invited you to Hollin Row Studio, the Editor role and three members as initials with 9 more beside a form with the invited address locked, a name and a new password, or just the password for an existing account.
- 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.