terra vidhal

Preferences Panel

Forms

About

A sectioned preferences panel for account, notification, security and appearance settings, with switches, radios, selects and a saved-state indicator.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Preferences Panel to your project and fits it to your theme.

Code

How Preferences Panel is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

/**
 * PrequelUI Animate — MIT — https://prequeluianimate.terravidhal.me
 */

import {
  PreferencesPanel,
  type PreferenceSection,
} from "@/components/ui/preferences-panel";

const SECTIONS: PreferenceSection[] = [
  {
    id: "account",
    label: "Account",
    icon: "user",
    description: "The details teammates see when they mention or assign you.",
    controls: [
      {
        id: "display-name",
        type: "text",
        label: "Display name",
        description: "Shown in comments, mentions and activity.",
        defaultValue: "Mara Ellison",
        placeholder: "Your name",
      },
      {
        id: "contact-email",
        type: "text",
        label: "Contact email",
        description: "Used for receipts and security alerts only.",
        defaultValue: "mara.ellison@example.com",
        placeholder: "name@example.com",
      },
      {
        id: "timezone",
        type: "select",
        label: "Time zone",
        description: "Dates and reminders follow this zone.",
        options: [
          { value: "system", label: "System default" },
          { value: "utc", label: "UTC" },
          { value: "plus-1", label: "UTC+01:00" },
          { value: "minus-8", label: "UTC−08:00" },
        ],
        defaultValue: "system",
      },
    ],
  },
  {
    id: "notifications",
    label: "Notifications",
    icon: "bell",
    description: "Choose what reaches you, and how often.",
    controls: [
      {
        id: "digest",
        type: "switch",
        label: "Weekly digest",
        description: "A short summary of activity every Monday morning.",
        defaultChecked: true,
      },
      {
        id: "mentions",
        type: "switch",
        label: "Mentions and assignments",
        description: "Notify me whenever someone hands me a task.",
        defaultChecked: true,
      },
      {
        id: "comments",
        type: "switch",
        label: "Replies on threads I follow",
        description: "One message per reply, grouped by thread.",
        defaultChecked: true,
      },
      {
        id: "product",
        type: "switch",
        label: "Product updates",
        description: "Occasional notes about new features and changes.",
        defaultChecked: false,
      },
      {
        id: "security",
        type: "switch",
        label: "Security alerts",
        description: "Sign-ins from new devices and permission changes.",
        defaultChecked: true,
      },
      {
        id: "frequency",
        type: "radio",
        label: "Delivery",
        description: "How quickly non-urgent updates arrive.",
        options: [
          {
            value: "instant",
            label: "As they happen",
            description: "One message per event.",
          },
          {
            value: "hourly",
            label: "Hourly summary",
            description: "Grouped into one message.",
          },
          {
            value: "daily",
            label: "Daily summary",
            description: "A single morning round-up.",
          },
        ],
        defaultValue: "hourly",
      },
    ],
  },
  {
    id: "security",
    label: "Security",
    icon: "shield",
    description: "Protect the account and keep sessions predictable.",
    controls: [
      {
        id: "two-factor",
        type: "switch",
        label: "Two-factor authentication",
        description: "Require a second step when signing in on a new device.",
        defaultChecked: true,
      },
      {
        id: "session-alerts",
        type: "switch",
        label: "New device alerts",
        description: "Email me when an unrecognised device signs in.",
        defaultChecked: true,
      },
      {
        id: "session-length",
        type: "select",
        label: "Stay signed in",
        description: "Sign out automatically after this period.",
        options: [
          { value: "1h", label: "1 hour" },
          { value: "12h", label: "12 hours" },
          { value: "7d", label: "7 days" },
          { value: "30d", label: "30 days" },
        ],
        defaultValue: "7d",
      },
    ],
  },
  {
    id: "appearance",
    label: "Appearance",
    icon: "palette",
    description: "Adjust the interface without changing the data.",
    controls: [
      {
        id: "theme",
        type: "radio",
        label: "Theme",
        description: "Follow the system or pin a mode.",
        options: [
          { value: "system", label: "Use system", description: "Match the device." },
          { value: "light", label: "Light", description: "Always bright." },
          { value: "dark", label: "Dark", description: "Always dim." },
        ],
        defaultValue: "system",
      },
      {
        id: "density",
        type: "select",
        label: "Layout density",
        description: "Controls spacing in tables and lists.",
        options: [
          { value: "comfortable", label: "Comfortable" },
          { value: "compact", label: "Compact" },
        ],
        defaultValue: "comfortable",
      },
      {
        id: "reduced-motion",
        type: "switch",
        label: "Reduce motion",
        description: "Limit transitions and animated previews in the app.",
        defaultChecked: false,
      },
    ],
  },
];

export default function PreferencesPanelDemo() {
  return (
    <main className="flex min-h-screen w-full items-center justify-center bg-gradient-to-b from-muted/40 via-background to-background px-4 py-6 sm:px-6">
      <PreferencesPanel
        variant="plain"
        sections={SECTIONS}
        title="Preferences"
        defaultActiveId="notifications"
        defaultValues={{ product: true }}
      />
    </main>
  );
}

Dependencies

More by terra vidhal

View all
  • Project Timeline

    Project Timeline

    30
  • Kanban Board

    Kanban Board

    20
  • Gravity Stars Background

    Gravity Stars Background

    20
  • Booking Calendar

    Booking Calendar

    18
  • Notification Center

    Notification Center

    16
  • Audio Waveform

    Audio Waveform

    16
  • Kpi Counter

    Kpi Counter

    16
  • Topographic Lines

    Topographic Lines

    16

More in Forms

View all
  • Form

    Form

    7
  • Login 2

    Login 2

    16
  • Contact Form

    Contact Form

    33
  • Contact Card

    Contact Card

    1.1K
  • Book A Demo 1

    Book A Demo 1

    95
  • Premium Auth

    Premium Auth

    613
  • Onboarding Stepper

    Onboarding Stepper

    13
  • Authentication Card

    Authentication Card

    52

Explore more

Part of PrequelUI Animate — browse the full library on 21st.dev.