Home / File/ notifications-form.tsx — ui Source File

notifications-form.tsx — ui Source File

Architecture documentation for notifications-form.tsx, a tsx file in the ui codebase. 10 imports, 0 dependents.

File tsx ComponentRegistry Styles 10 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  14900466_ac7a_7b6e_26a9_936216f7fa6a["notifications-form.tsx"]
  ba3d44f3_7b34_f9cc_6283_44817785c0df["link"]
  14900466_ac7a_7b6e_26a9_936216f7fa6a --> ba3d44f3_7b34_f9cc_6283_44817785c0df
  3d40a3bf_c062_4304_329a_00b1b72e8523["zod"]
  14900466_ac7a_7b6e_26a9_936216f7fa6a --> 3d40a3bf_c062_4304_329a_00b1b72e8523
  6d65354d_8f59_2cfc_4783_24b2eb870bc4["react-hook-form"]
  14900466_ac7a_7b6e_26a9_936216f7fa6a --> 6d65354d_8f59_2cfc_4783_24b2eb870bc4
  6802ce19_522d_e5fb_e458_8826d9f6952e["zod"]
  14900466_ac7a_7b6e_26a9_936216f7fa6a --> 6802ce19_522d_e5fb_e458_8826d9f6952e
  64d95022_f8e1_3e94_bb97_22b3ebca757e["use-toast"]
  14900466_ac7a_7b6e_26a9_936216f7fa6a --> 64d95022_f8e1_3e94_bb97_22b3ebca757e
  aa2f3ec6_f291_3763_88ec_65a3f5ad5939["button"]
  14900466_ac7a_7b6e_26a9_936216f7fa6a --> aa2f3ec6_f291_3763_88ec_65a3f5ad5939
  fe882581_4266_6b26_b40f_462b3a19ebd0["checkbox"]
  14900466_ac7a_7b6e_26a9_936216f7fa6a --> fe882581_4266_6b26_b40f_462b3a19ebd0
  7a6b0be4_eca5_4970_1a93_79d670ef529e["form"]
  14900466_ac7a_7b6e_26a9_936216f7fa6a --> 7a6b0be4_eca5_4970_1a93_79d670ef529e
  e3816a69_e9ee_ea7d_ed26_21225e55c2ff["radio-group"]
  14900466_ac7a_7b6e_26a9_936216f7fa6a --> e3816a69_e9ee_ea7d_ed26_21225e55c2ff
  792bdb4b_081b_acca_8721_dff659e00c59["switch"]
  14900466_ac7a_7b6e_26a9_936216f7fa6a --> 792bdb4b_081b_acca_8721_dff659e00c59
  style 14900466_ac7a_7b6e_26a9_936216f7fa6a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import Link from "next/link"
import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import { z } from "zod"

import { toast } from "@/registry/new-york/hooks/use-toast"
import { Button } from "@/registry/new-york/ui/button"
import { Checkbox } from "@/registry/new-york/ui/checkbox"
import {
  Form,
  FormControl,
  FormDescription,
  FormField,
  FormItem,
  FormLabel,
  FormMessage,
} from "@/registry/new-york/ui/form"
import { RadioGroup, RadioGroupItem } from "@/registry/new-york/ui/radio-group"
import { Switch } from "@/registry/new-york/ui/switch"

const notificationsFormSchema = z.object({
  type: z.enum(["all", "mentions", "none"], {
    required_error: "You need to select a notification type.",
  }),
  mobile: z.boolean().default(false).optional(),
  communication_emails: z.boolean().default(false).optional(),
  social_emails: z.boolean().default(false).optional(),
  marketing_emails: z.boolean().default(false).optional(),
  security_emails: z.boolean(),
})

type NotificationsFormValues = z.infer<typeof notificationsFormSchema>

// This can come from your database or API.
const defaultValues: Partial<NotificationsFormValues> = {
  communication_emails: false,
  marketing_emails: false,
  social_emails: true,
  security_emails: true,
}

export function NotificationsForm() {
  const form = useForm<NotificationsFormValues>({
    resolver: zodResolver(notificationsFormSchema),
    defaultValues,
  })

  function onSubmit(data: NotificationsFormValues) {
    toast({
      title: "You submitted the following values:",
      description: (
        <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
          <code className="text-white">{JSON.stringify(data, null, 2)}</code>
        </pre>
      ),
    })
  }

// ... (163 more lines)

Subdomains

Dependencies

  • button
  • checkbox
  • form
  • link
  • radio-group
  • react-hook-form
  • switch
  • use-toast
  • zod
  • zod

Frequently Asked Questions

What does notifications-form.tsx do?
notifications-form.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, Styles subdomain.
What functions are defined in notifications-form.tsx?
notifications-form.tsx defines 1 function(s): NotificationsForm.
What does notifications-form.tsx depend on?
notifications-form.tsx imports 10 module(s): button, checkbox, form, link, radio-group, react-hook-form, switch, use-toast, and 2 more.
Where is notifications-form.tsx in the architecture?
notifications-form.tsx is located at deprecated/www/app/(app)/examples/forms/notifications/notifications-form.tsx (domain: ComponentRegistry, subdomain: Styles, directory: deprecated/www/app/(app)/examples/forms/notifications).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free