Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Email Preferences Settings Block for React

A preference-centre page, the one an email footer links to: five topics each with a switch and a frequency menu, a digest mode, a computed email volume and an unsubscribe-from-everything that locks the rows and turns Save into Resubscribe.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Give subscribers the page your email footer links to, with this preference centre for React with Base UI. It is a whole screen: the page's rails and one band across it, the form centred in the band. A newsletter's mark, the heading and the address the preferences are for sit over five topics (product news, a weekly digest, tips, events and surveys), each a Switch and a Native Select of how often. A digest mode folds the other topics into the digest's one email, the menus then read "In the digest", and one sentence says what the choices amount to ("About 7 emails a month"). The one Shine Button saves the choices in the page. "Unsubscribe from everything" is a quiet outline Button: it locks every row in place, says so, and turns the Shine Button into Resubscribe, which brings the topics back exactly as they were. On a phone the rows stay one line each and the primary button stays pinned to the bottom of the screen. It's built from Switch, Native Select, Button, Shine Button and Guides, with a CSS entrance only. For the unsubscribe link of any newsletter, a product's email settings or a marketing preference page.

FAQ

How do I fill it with my own topics?

Edit TOPICS. Each topic has an id, a name, a one-line hint and its choices, the frequencies the menu offers, each with the average emails a month it sends (perMonth, which can be a fraction for a quarterly survey). SAVED is what the subscriber has stored when the page opens: the topics that are on, the frequency chosen for each, and whether digest mode is on. ADDRESS is the address the preferences are for, and DIGEST names the topic that digest mode folds the others into. The email volume is worked out from those, so it is never typed.

What does digest mode do?

It sends the topics that are on inside the weekly digest's one email instead of on their own schedule. While it is on, their menus read "In the digest" and are disabled, and the sentence counts only the digest. It needs the weekly digest switched on, so with the digest off the switch is disabled and says why, and nothing is folded into an email that will not be sent.

What does Unsubscribe from everything do, and how do I get back?

It switches every row off and disables it, in place, so the page keeps its shape, and it says "You are unsubscribed from everything" in the status line. Focus moves to the main button, which now reads Resubscribe. Pressing it turns the rows back on exactly as they were, with the frequencies and digest mode you had, since the choices are kept and only shown as off. Real unsubscribes should be one click with no sign-in, which is why the button needs no confirmation, and the way back is always on the page.

What stays local, and how do I make it real?

Nothing leaves the page: no email is sent and nothing is stored, and the status line says "in this demo" after each action. The block keeps the saved choices and the ones being edited, counts what differs and says so when you save ("Saved 2 changes in this demo"). To make it real, identify the subscriber from a signed token in the footer link, send the choices to your API in the submit handler and update the saved copy from the response, showing a failure in the same status line.

How does it look on a phone?

Each topic stays one line: the switch, the name and the frequency menu, with the one-line description kept for screen readers only to leave room. The Shine Button is pinned to the bottom of the screen while the topics scroll behind it, so it is always in reach, and it settles in its place at the end of the form. The page is full height and centred on a tall screen, and starts at the top on a short one.

Is it accessible?

Every switch is named for its topic and described by its hint, and every menu is a native select named "How often: Tips", so it works with a screen reader, a keyboard and the phone's own picker. The status line is a polite live region present from the start: it speaks the new email volume after each change and the result after Save or Unsubscribe. The email address is kept in its own left-to-right run inside the sentence in right-to-left languages.

  • Pro

    A 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

    A changelog email panel of subscription cells on shared hairlines, one per product area with its release strip and a Follow toggle, a delivery choice, locked breaking changes and a computed email volume.

  • Pro

    A 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

    A reading-preferences prompt for a reading app: three toggles with a live preview that changes size, weight and border, a polite count, and Save, Reset and Not now.

  • Pro

    A setting callout for an uptime monitor: a card in card with a bell icon, a heading and a sentence, and an Off or On label beside a switch that rewrites the sentence and lights a status dot.

  • Pro

    A vacation responder settings panel that leads with the sentence the settings amount to, a form with a subject, a message with variable chips, two date fields and a once-per-sender rule, beside a framed drawn email filled from a sample sender.