shadcn.io is not affiliated with official shadcn/ui
Connected Accounts Account Block for React
The sign-in providers linked to an account: each with its address, link date and use history, an Unlink that asks first and refuses on the only way in, an Undo line and quiet buttons to link more.
Installation
Overview
Let people see which accounts can sign them in, and how much each has been used, with this connected accounts panel for React with Base UI. A compact header holds the title and one sentence, with no call to action because nothing here moves the account forward. Inside a hairline frame with a plus mark on each corner, a ruled list shows every linked provider as a lettermark tile, its name, the address it gave, the day it was linked and a count of sign-ins. A Sign-ins Button opens that provider's history in place: a sentence ("Signed in 14 times with Google, last 12 Oct from Lisbon"), its last three sign-ins and a quiet Check this connection. Unlink opens an Alert Dialog, and when it would remove the last way in the button stays visible, says why in a Badge and a line beside it, and refuses. Providers not yet linked are quiet buttons that add a row. The foot holds a polite status line and an Undo for the last unlink. It's built from Alert Dialog, Badge, Button and Guides, with a CSS entrance only. For an account page, a security settings screen or any app that offers social sign-in.
FAQ
How do I fill it with my own providers?
Edit PROVIDERS for the services you offer (an id, a two-letter mark for the neutral tile, the name and the address the service returned) and LINKS for what this person has linked: the ISO day it was linked, how many times it has signed them in and the last three sign-ins, newest first. Dates are formatted in UTC so they read the same on the server and in every time zone. The counts in the header, the sentence in each pane and the list of providers still to link are all worked out from those two lists. The tiles are placeholders: drop in a logo you have the rights to use.
What stays local, and how do I make it real?
Everything. Linking adds a row to the page's state and says so ("Nothing opened at Apple"), Check this connection only reports what a real check would do, and Unlink removes the row and keeps it on an undo stack. No provider is contacted and nothing is stored. To wire it, start the provider's OAuth flow from the Link buttons, call your server to revoke the link in unlink, and fill LINKS from your user record; the dialog's copy already says that nothing changes at the provider.
Why can't I unlink the last account?
The example account has no password, so a linked provider is the only way in. When one remains its Unlink button gets aria-disabled, a Only way in badge and a line saying to link another account first, and pressing it answers in the status line instead of opening a dialog. Link another provider and both rows can be unlinked again. If your accounts always have a password, remove the rule by letting only be false.
How does Undo work?
Unlinking removes the row at once and pushes it with its position onto a small stack; the Undo button at the foot puts the last one back where it was, with its history, and moves focus to it. Linking a provider again by hand clears its entry from the stack so a row can never appear twice. With nothing to undo the button stays in place, looks quiet and answers "Nothing to undo."
How does the unlink dialog work on each library?
AlertDialogTrigger through render. Focus starts on Keep it linked and moves to the next row afterwards.Is it accessible?
The linked accounts are a real list, every button names its provider ("Sign-ins for GitHub", "Unlink GitHub"), and the disclosure is a button with aria-expanded and aria-controls whose closed content is inert. The tiles are hidden from assistive technology because the name is always beside them. The dialog traps focus and closes with Escape. One polite status line reports each link, unlink, check and undo, and counts and addresses keep their direction in an RTL layout.
Related
- Pro
Linked Accounts Account
Connected appsWhen a provider's email is not yours: a table of what each provider returned, a choice under each mismatch to add it as a second email or keep it separate, and a count of sign-ins that would make a new account.
- Pro
Login Providers Account
Sign-in methodsGo passwordless safely: the sign-in methods ranked by strength as a ladder, the four things that must hold first, and one button that turns the password off only when they all do.
- Pro
Third-Party Apps Account
Connected appsOAuth grants as a table: each app with its access level, grant date and last use, unused apps pinned to the top, scopes in plain words, a Revoke that can be undone and a bulk revoke that asks first.
- Pro
A panel of four sign-in methods (Password, Google, GitHub, X) with Connect and Disconnect that refuses to remove the last one, an alert dialog and Undo for the others, and a choice of which shows first.
- 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
Connected Accounts Settings
Fields and formsA profile fields table where each field picks its source (by hand, Google, GitHub or Strava), and the accounts below it, which can't be disconnected while they still supply a field.