DS0
Patterns

Notification Settings

A notification preferences panel with categorized toggle switches.

Overview

The NotificationSettings recipe provides a grouped notification preferences panel. Settings are automatically grouped by their category field and rendered as labeled Switch toggles.

Notifications

Choose what you want to be notified about.

Email notifications

Receive email about account activity

Push notifications

Receive push notifications on your device

Marketing emails

Receive emails about new features and tips

Security alerts

Get notified about security events

Usage

import { NotificationSettings } from '@/recipes/notification-settings';

<NotificationSettings
  settings={[
    { id: '1', category: 'Email', label: 'Marketing', description: 'Receive marketing emails', enabled: true },
    { id: '2', category: 'Email', label: 'Updates', description: 'Product updates and news', enabled: false },
    { id: '3', category: 'Push', label: 'Messages', description: 'New message notifications', enabled: true },
  ]}
  onSettingChange={(id, enabled) => updateSetting(id, enabled)}
  onSave={() => savePreferences()}
/>

API Reference

PropTypeDefaultDescription
settingsNotificationSetting[]Current notification settings
onSettingChange(id: string, enabled: boolean) => voidToggle handler
onSave() => voidSave all handler
isLoadingbooleanfalseLoading state
classNamestringAdditional CSS classes

NotificationSetting

interface NotificationSetting {
  id: string;
  category: string;
  label: string;
  description: string;
  enabled: boolean;
}

On this page