preset-selector.tsx — ui Source File
Architecture documentation for preset-selector.tsx, a tsx file in the ui codebase. 8 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR e097816f_6d96_f113_8f37_4e2d8d220098["preset-selector.tsx"] 89426f86_36d1_8e36_81ab_b4b18f3876c7["presets.ts"] e097816f_6d96_f113_8f37_4e2d8d220098 --> 89426f86_36d1_8e36_81ab_b4b18f3876c7 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] e097816f_6d96_f113_8f37_4e2d8d220098 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3["lucide-react"] e097816f_6d96_f113_8f37_4e2d8d220098 --> d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3 9c463da6_747b_38dc_586b_cbb4873070b1["radix-ui"] e097816f_6d96_f113_8f37_4e2d8d220098 --> 9c463da6_747b_38dc_586b_cbb4873070b1 79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"] e097816f_6d96_f113_8f37_4e2d8d220098 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81 57e86e45_ac6e_7278_be08_9092724e8401["button"] e097816f_6d96_f113_8f37_4e2d8d220098 --> 57e86e45_ac6e_7278_be08_9092724e8401 ea5fe791_bf71_2e59_8da4_433dcd06ee7b["command"] e097816f_6d96_f113_8f37_4e2d8d220098 --> ea5fe791_bf71_2e59_8da4_433dcd06ee7b 64a3481c_a85b_fe79_409a_cb7f3f4bb871["popover"] e097816f_6d96_f113_8f37_4e2d8d220098 --> 64a3481c_a85b_fe79_409a_cb7f3f4bb871 5ee45142_aa10_ca73_456e_5946db3e53c3["page.tsx"] 5ee45142_aa10_ca73_456e_5946db3e53c3 --> e097816f_6d96_f113_8f37_4e2d8d220098 style e097816f_6d96_f113_8f37_4e2d8d220098 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
import { Check, ChevronsUpDown } from "lucide-react"
import type { Popover as PopoverPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
import { Button } from "@/registry/new-york-v4/ui/button"
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
} from "@/registry/new-york-v4/ui/command"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/registry/new-york-v4/ui/popover"
import { type Preset } from "../data/presets"
interface PresetSelectorProps
extends React.ComponentProps<typeof PopoverPrimitive.Root> {
presets: Preset[]
}
export function PresetSelector({ presets, ...props }: PresetSelectorProps) {
const [open, setOpen] = React.useState(false)
const [selectedPreset, setSelectedPreset] = React.useState<Preset>()
return (
<Popover open={open} onOpenChange={setOpen} {...props}>
<PopoverTrigger asChild>
<Button
variant="outline"
role="combobox"
aria-label="Load a preset..."
aria-expanded={open}
className="flex-1 justify-between md:max-w-[200px] lg:max-w-[300px]"
>
{selectedPreset ? selectedPreset.name : "Load a preset..."}
<ChevronsUpDown className="opacity-50" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-[300px] p-0">
<Command>
<CommandInput placeholder="Search presets..." />
<CommandList>
<CommandEmpty>No presets found.</CommandEmpty>
<CommandGroup heading="Examples">
{presets.map((preset) => (
<CommandItem
key={preset.id}
onSelect={() => {
setSelectedPreset(preset)
setOpen(false)
}}
>
{preset.name}
<Check
className={cn(
"ml-auto",
selectedPreset?.id === preset.id
? "opacity-100"
: "opacity-0"
)}
/>
</CommandItem>
))}
</CommandGroup>
<CommandSeparator />
<CommandGroup>
<CommandItem>More examples</CommandItem>
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
)
}
Domain
Subdomains
Functions
Types
Dependencies
- button
- command
- lucide-react
- popover
- presets.ts
- radix-ui
- react
- utils
Imported By
Source
Frequently Asked Questions
What does preset-selector.tsx do?
preset-selector.tsx is a source file in the ui codebase, written in tsx. It belongs to the ApplicationExhibition domain, PlaygroundAI subdomain.
What functions are defined in preset-selector.tsx?
preset-selector.tsx defines 1 function(s): PresetSelector.
What does preset-selector.tsx depend on?
preset-selector.tsx imports 8 module(s): button, command, lucide-react, popover, presets.ts, radix-ui, react, utils.
What files import preset-selector.tsx?
preset-selector.tsx is imported by 1 file(s): page.tsx.
Where is preset-selector.tsx in the architecture?
preset-selector.tsx is located at apps/v4/app/(app)/examples/playground/components/preset-selector.tsx (domain: ApplicationExhibition, subdomain: PlaygroundAI, directory: apps/v4/app/(app)/examples/playground/components).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free