shadcn.io is not affiliated with official shadcn/ui
Quick Actions Login Block for React
A return-to sign-in: five destination rows with the keys 1 to 5, a password and a button that reads Sign in and open Inbox, and an always pick up where I stopped switch that picks the first row.
Installation
Overview
Let people say where they are going before they sign in, with this quick actions login block for React with Base UI. It's the sign-in page of Todoloft, a task manager, split in two under the page's rails and one band across the screen. At the start are the header and five destinations as native radio rows (Resume the Q4 plan, Open your inbox, Website relaunch, Account settings and Home), each with its key from 1 to 5: pressing a digit while focus is inside the block, and not in a text field, chooses that row. At the end are the password and the one Shine Button, whose label follows the choice ("Sign in and open Inbox"), and a Switch, Always pick up where I stopped, that chooses the first row and dims the others. A sign-in shows, in the form's own space, where a real one would land you. It's built from Switch, Kbd, Field, Password Input, Button, Shine Button and Guides, with native radio inputs and a CSS entrance only. For apps with a few places people usually return to.
FAQ
What stays in the page, and how do I wire it for real?
Everything. The five destinations, their notes, the signed-in address and the switch are typed, any password is accepted, and a sign-in only shows where a real one would land you. In a product, send the chosen destination (as a path, validated against your own routes) with the sign-in request, and store the always-resume choice on the account.
How do the number keys work?
While focus is anywhere in the block but a text field, the digits 1 to 5 choose the row with that number, say so in a polite message and move focus to it. They are not bound to the page, so they never fight the browser, and they are ignored with Ctrl, Alt or Command held, in the password field (where digits are typing) and while the switch is on.
What does the switch do?
Turned on, it chooses Resume the Q4 plan, dims the other rows (they leave the Tab order, and the text under the switch says why) and the button reads "Sign in and open the Q4 plan". Turned off, the rows are live again with the first still chosen. It is a native-feeling switch named by its own text, in the foreground color rather than the primary one.
Why does the button's label change?
So the one thing the person is about to do is always spelled out: "Sign in and open Website" names where they will land. An empty password is caught on the press: it says "Enter your password." under the field and moves focus there, and nothing is submitted.
How are the rows built for a screen reader?
They are native radio inputs in one list named "Where to land after you sign in". Each row is read as its title with the note as its description, and announces the shortcut key. The key caps drawn at the end of a row are hidden from assistive technology so the name stays short.
Related
- Pro
Welcome Back Login
Account choosersA full-height returning-user sign-in for a reading tracker: a large initials avatar, Welcome back, Dara, a read-only address and one password field, with a swap to a different account at the same height.
- 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
Recent Accounts Login
Account choosersAn account chooser: three recent accounts as hairline rows with initials and a session state, Remove with a permanent Undo, and a password, a plain Continue or an email and password pair under the list.
- Pro
Tenant Select Login
Workspaces and rolesThe workspace chooser shown after sign-in: a signed-in line, a filter, a native table of four workspaces sortable by name or last used, a star that sets the default and one button that opens the chosen one.
- Pro
Email First Sign In Login
Step by stepAn identifier-first sign-in for an invoicing app: one email field, a lookup against two typed accounts, then either the password step with the address kept as a badge or account creation with the address carried over.
- Pro
Avatar Preview Login
Account choosersA full-height sign-in page for a family organizer where a large avatar builds from the email as you type, a typed demo account shows its name, and Enter takes you to the password.