App, notification preferences


Install
npx shadcn add @klarhimmel/app-settings-notificationsDetailsAbout, usage, props and more
A list of notification preferences, each a title, one line of explanation and a switch (applies at once) or a checkbox (saved with a button).
Import
Import
- app/settings-notifications
- About
- A list of notification preferences, each a title, one line of explanation and a switch (applies at once) or a checkbox (saved with a button). The on/off state of every row is a prop.
- Category
- Interface sections for signed-in products. New project? Set it up once: /get-started/installation.
Notes
When to use it
A list of preferences with an on or off state per row. It fits a settings page; to read what has already arrived, use app-notifications-inbox. Choose switch when each change should apply at once and checkbox when rows are saved together.
Writing for it
- The control enum decides the whole block. With switch there is no save button, so the save text (30) is only used with checkbox. - A row title holds 60 characters and the description 140. Describe when the message is sent, such as 'every Monday at 08:00', rather than repeating the title. - The on field carries the starting state of each row, so set it to the person's current choice and not to a default you hope for. Two to seven rows are allowed.
Watch out for
The block does not save anything by itself. Switches change visually on click, but persisting them is up to the host app, so a preview that looks saved is not a stored preference.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
Props
The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.
| Prop | Type | Default | Description |
|---|---|---|---|
eyebrow | string | 'Settings' | Text, up to 60 characters. Optional; empty is not rendered. |
title | string | 'Notifications' | Text, up to 120 characters. |
description | string | 'Say what the person can choose and …' | Text, up to 300 characters. Optional; empty is not rendered. |
control | 'switch' | 'checkbox' | 'switch' | One of 'switch', 'checkbox'. |
rows | { title, description, on }[] | 4 items | List of 2 to 7. Each item: title, description, on. |
save | string | 'Save preferences' | Text, up to 30 characters. |
headingLevel | '1' | '2' | - | One of '1', '2'. Optional; empty is not rendered. |