shadcn.io is not affiliated with official shadcn/ui
Social Links Settings Block for React
A social links editor with five places for links: each address is recognised and checked against its service's shape, shown or hidden, moved and removed, with Add by pasting, a preview of the links on the page and an Undo.
Installation
Overview
Let people choose which links their page shows, and in what order, with this social links editor for React with Base UI. A hairline frame with a plus mark on each corner holds five places for links. Each filled place has a two-letter tile, the name of the service its address was recognised as, the address in an Input, a Switch that shows or hides it on the page, and Move up, Move down and Remove buttons. An address is checked against the shape its service uses and a wrong one says so in words, such as "GitHub links look like github.com/handle."; an address from any other host becomes a Website. Under the rows, Add by pasting reads a pasted address and says what it recognised before it takes a free place, and a last band lists the links the page will show, in order. The action foot counts unsaved changes beside a Shine Button to save them and an outline Button to discard them, and an Undo walks back the last add, move or removal. On a phone each place is a card with the same controls. It's built from Input, Switch, Button, Shine Button and Guides, with a CSS entrance only. For a portfolio, a creator page, a team directory or any profile that lists where to find someone.
FAQ
How is an address recognised?
A small pure function reads the address you type or paste. It accepts the address with or without https:// and www., looks up the host in SERVICES (GitHub, GitLab, LinkedIn, YouTube and Dribbble), and tests the path against that service's handle shape: github.com/handle, linkedin.com/in/handle, youtube.com/@handle. A host it doesn't know becomes a Website, and its tile and name follow the address as you edit it. Add a service by adding an entry with its host, path prefix, handle pattern and two-letter mark. Nothing is looked up on the network: whether a profile exists is for your server to check.
What counts as a wrong address, and where is it said?
An empty field, an address with spaces, text that isn't a web address, http instead of https, and a known service whose path doesn't fit its shape ("LinkedIn links look like linkedin.com/in/handle."). The message sits under the row's input in a place reserved for it, so a message never moves the rows, and the input is marked invalid. Save refuses while any row has a problem, says how many links need fixing, and puts focus on the first one.
How do I change the order without dragging?
Each row has a Move up and a Move down button named for its link, such as "Move GitHub up". The one at an end stays in place and focusable but doesn't act, and says so; after a move focus stays on the button you pressed, and the polite status line says the new place, "GitHub moved to place 2 of 4." The rows keep their positions and their content changes, so nothing jumps while you reorder. There is no drag handle: a dragged order has to be reachable by keyboard anyway, and these buttons are that route.
What does Undo undo, and what does Save do?
Undo walks back the last five adds, moves and removals, one step per press; its name says which step ("Undo removing GitHub"). Typing in an address isn't a step, but Discard puts everything back as it was when last saved. Save keeps the edited list as the saved one, in this page only, and says how many changes it kept; it also clears the Undo steps. Both Save and Discard stay in place and focusable while nothing changed, and answer "No changes to save." instead of disappearing.
What stays local, and how do I wire it up?
Everything. The handles are made up, the preview chips are plain text rather than links, and Save only copies the list into the page's own state. To make it real, send the saved list (each link's address, whether it shows and its position) to your API in the save handler, and render the page's links from the same list. Keep the check on the server too: the pattern here is a courtesy to the person typing, not a guarantee.
Is it accessible, and how does it look on a phone?
Every input is labelled by its service, every switch reads "Show GitHub on your page", and every button names its link. The status line is a polite live region that is present from the start; it says what changed and counts what isn't saved. The five places always take the same height, filled or free, so adding and removing never move the panel. Below the small breakpoint a place becomes a card: the tile and name with the switch, the address, then the problem beside the three buttons; the save bar stays pinned to the bottom of the screen.
Related
- Pro
Social Profiles Account
VerificationVerify the handles you claim: a framed card per network with its handle and state, a code to put in your bio and a Check now, a verified mark on the profile line, and a form that adds another network.
- Pro
Profile Settings
Privacy and consentA profile visibility page: five parts of a profile, each with a menu for who sees it (Everyone, Workspace, Only me), beside a drawn profile card with a Preview as choice (Public, Teammate, Me) that hides what that viewer cannot see.
- 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.
- Pro
Brand Asset Settings
Appearance and localeA logo check panel: Paper and Ink tiles showing a drawn lettermark at true size with its clear space in hairlines and its contrast worked out from the hex values, a Full, Mark or Mono toggle, a size slider that warns below 24 px, and a four-colour palette with Copy.
- Pro
Notification Preferences Settings
NotificationsA notification settings panel: a channel strip with all-or-nothing checkboxes, a matrix of switches by activity and channel with a locked security email, quiet hours, and a save bar that counts unsaved changes.
- Pro
Team Members Settings
Team and rolesA members panel with seat and two-factor meters, a native table with row selection, a role menu per person and, pinned at the foot, a bulk role change and Remove that an Undo walks back one step at a time.