Notification Preferences

What reaches you and where: a switch per notice and channel, and a pause with an end.

PROGet Notification Preferences and 168 other Pro components with pro lifetime — Get Pro

Category
Workspace
Access
Pro
Source
278 lines · one file
States
5 drawn
Added
3 Nov 2026

The decision inside it

Security notices can't be turned off, and quiet always ends

A notification setting that silently stays off for months is how a breach notice goes unread. Security rows are locked on, and a pause is chosen with an end time: an hour, until tomorrow morning, a week.

When to use it

Use Notification Preferences on a settings page where people choose which notices reach them by email, push or Slack. For the notices themselves use Notification Panel.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Notification Preferences for this.
Install it: npx shadcn@latest add @liro/notification-preferences
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/notification-preferences.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/notification-settings.tsx
import { NotificationPreferences, type NotifyGroup, type NotifyChannel } from "@/components/ui/notification-preferences";

export function NotificationSettings({ groups, pausedUntil, api }: {
  groups: NotifyGroup[];
  pausedUntil: number | null;
  api: {
    save: (eventId: string, channel: NotifyChannel, on: boolean) => Promise<void>;
    pause: (until: Date | null) => Promise<void>;
  };
}) {
  return (
    <NotificationPreferences
      groups={groups}
      pausedUntil={pausedUntil}
      channelIcons={{ email: <img src="/logos/gmail.svg" alt="" />, slack: <img src="/logos/slack.svg" alt="" /> }}
      onChange={api.save}
      onPause={api.pause}
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
groupsNotifyGroup[] Yes–
channelsNotifyChannel[] No–
onChange(eventId: string, channel: NotifyChannel, on: boolean) => void | Promise<void> NoSaves one switch. May return a promise; if it rejects, the switch goes back.
pausedUntilDate | number | null NoThe end of a pause, if one is running.
onPause(until: Date | null) => void | Promise<void> NoStarts a pause until the given time, or ends it with null. May return a promise.
channelIconsPartial<Record<NotifyChannel, React.ReactNode>> NoLogos for the channel headers, supplied by you: your mail provider, Slack, your app icon.
titlestring No–
nowDate | number No–
lookLook No–

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themebutton

States

All of them are drawn by the component. None is left for you to design.

  • Preferences
  • Saving
  • Save failed
  • Paused
  • Locked

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances