shadcn.io is not affiliated with official shadcn/ui
Privacy Card Switches Form Block for Solid
Four privacy settings as whole-card switches in one column: press anywhere on a card to flip it, a count says how many are visible to others, and a save bar keeps or discards the changes.
Installation
Overview
Make a switch as easy to hit as a button with this card switch form for Solid with Ark UI. A compact header sits over a hairline frame with a plus mark on each corner. The first band lists four privacy settings for a journal app in one column of cards on shared hairlines: each card is a name, a sentence on what it shares, an On or Off word and a Switch, and the whole card is the hit area, so pressing the sentence flips it as pressing the switch does. Focus rings the card, and a card that is on carries a foreground ring, so the state reads from across the page as well as from the switch. The band's count says how many of the four are visible to others and a note under the cards says entries are never shared. The foot counts unsaved changes beside a Shine Button to save them and an outline Button to discard them. It's built from Switch, Button, Shine Button and Guides, with a CSS entrance only. For privacy and sharing settings, profile visibility and any short list of independent yes-or-no choices.
FAQ
How do I add or change a setting?
Edit SETTINGS at the top: each has an id, a name and a hint. START lists the ids that are on when the page opens. The count in the band and the changes counted in the foot are worked out from the draft list and the saved list, so a fifth card needs no other change; change the "of 4" in the band's text to match.
How does the whole card work as a switch?
The switch's own hit area is stretched to the edges of the card with a CSS pseudo-element, so there is one control, not a card wrapped around a button. A card is therefore one tab stop, Space flips it, and a screen reader reads the switch's name. The visible name and the sentence are the same text, so nothing is read twice.
Is the state shown by more than color?
Yes. Each card says On or Off in words, the switch moves, and an on card has a ring in the foreground color. The focus ring is a separate, thicker ring on the card, so a focused card that is on still shows both.
How does it look on a phone?
The cards stay one per row at full width, each with its sentence wrapping under the name, and the foot is pinned to the bottom of the screen with Save and Discard side by side.
Related
- Editor Options Side By Side Switch FormSwitches and toggles
- Two-Step Verification Switch With Description FormSwitches and toggles
- Pause All Switch Group FormSwitches and toggles
- Maintenance Mode Switch FormSwitches and toggles
- Notification Preferences SettingsNotifications
- Blocked and Muted People AccountPrivacy and consent