Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Reading Preferences Multi-Action Banner Block for React

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.

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

A preferences card for React with Base UI, where every choice shows its effect before it is saved. Walnutdeck's card sits between the page's solid rails, split by a solid divider. At the start an icon, a heading, a sentence and a group of three toggles: Larger text, High contrast and Reduce motion, each with an icon and a visible label, and a polite "2 of 3 enabled" under them. At the end a preview sentence really changes: bigger, heavier and with a stronger border as the toggles move, with a line that says whether pages slide in or turn at once. A footer holds a Shine Button "Save preferences", an outline "Reset" and a ghost "Not now" that folds the whole block away. It's built from Toggle Group, Button and Guides with your theme's tokens for every colour; pressed toggles are foreground, so the primary stays on Save. For reading apps, docs sites and any accessibility settings that people should be able to try first.

FAQ

What do the toggles change?

Only the preview in the card, not the rest of your page, so a visitor can try a setting without the layout moving. Larger text raises the preview's size from text-sm to text-lg, High contrast switches it from the muted tone to full foreground at semibold with a foreground border, and Reduce motion changes the line under it from "Pages slide in." to "Pages turn at once." To apply a setting to the page, read the on list in save and set a class or attribute on your document.

How is the count announced?

"2 of 3 enabled" is a polite live line under the toggles, so a screen reader hears it after each press without interrupting. After Save it reads "2 of 3 enabled, saved", and any change clears the "saved". The toggles themselves announce their name and pressed state.

What do Save, Reset and Not now do?

Save marks the current choice as saved (the line says so) and leaves the card in place; wire it to your settings store. Reset turns every toggle off and clears the saved note. Not now folds the block away with a CSS height transition and leaves focus on a visually hidden line, "Reading preferences kept as they were."

How do the toggles work with the keyboard?

Each toggle is a button with a pressed state that Space or Enter flips. The toggles form a group named "Reading preferences"; on some libraries the arrow keys move between the toggles and on others Tab does, as that comes from the library you chose, and every toggle can be reached either way.

Why do the toggles have visible labels and no tooltips?

A tooltip that only appears on hover or focus hides the name from touch users, and a toggle whose label is an icon alone is a guess. Each toggle shows its icon and its words, so the card reads the same for everyone and nothing is hidden behind a hover.

How does it fit on a phone?

The toggles wrap to as many rows as they need and the preview sits under them under a rule, with the three buttons stacked at full width below. At 320 pixels nothing scrolls sideways, and in a right-to-left layout the divider and the order of the two parts mirror.

  • Pro

    A consent card for a publisher site: four categories as a 2 by 2 of switch cells on shared hairlines, Essential locked on, with a Shine Button Save choices and an outline Accept all.

  • 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 theme pill for a writing app: a three-way toggle group (Light, System, Dark) seeded from the page's theme, with a label that says which one is on.

  • Pro

    A corner-radius picker card for a design-token editor: four chips drawn with their own corners, a greyscale preview that re-rounds as you choose, and Apply and Reset actions.

  • Pro

    A thumbs vote for a feature-flag tool that opens an optional comment box in place, with a Shine Button Send feedback, a ghost Skip and a thank-you line that replaces the vote.

  • Pro

    A cookie prompt for an online shop: one split card with a stack of three equal-width choices, Accept all, Reject non-essential and Manage preferences.