CreateProject
neon-ui/create-projectFreeBlock
Create-project onboarding panel: project form on the left, the interactive region map on the right.
Install it
npx shadcn@latest add https://ui.neon.com/r/create-project.jsonSource
1"use client";23import { Cancel01Icon, DicesIcon, ZapIcon } from "@hugeicons/core-free-icons";4import { HugeiconsIcon } from "@hugeicons/react";5import type { ComponentProps, FormEvent, ReactNode } from "react";6import { useId, useRef, useState } from "react";78import { RegionCard } from "@/components/region-card/region-card";9import { RegionGlobe } from "@/components/region-globe/region-globe";10import type { ServerRegion } from "@/components/region-select/region-select";11import { Button } from "@/components/ui/button";12import { Input } from "@/components/ui/input";13import { Label } from "@/components/ui/label";14import {15 Select,16 SelectContent,17 SelectItem,18 SelectTrigger,19 SelectValue,20} from "@/components/ui/select";21import { Switch } from "@/components/ui/switch";22import { cn } from "@/lib/utils";2324export interface CreateProjectValues {25 name: string;26 postgresVersion: string;27 regionId: string;28 enableAuth: boolean;29}3031export type CreateProjectProps = Omit<32 ComponentProps<"form">,33 "onSubmit" | "title"34> & {35 /** Regions offered in the picker and plotted on the map. */36 regions: ServerRegion[];37 /** Postgres versions offered, newest first. */38 postgresVersions?: string[];39 /** Initial Postgres version; defaults to the first offered. */40 defaultPostgresVersion?: string;41 /** Initial region id; defaults to the first region. */42 defaultRegionId?: string;43 /** Called with the form values when Create is pressed. */44 onSubmit?: (values: CreateProjectValues) => void;45 /** Renders the Cancel action. */46 onCancel?: () => void;47 /** Renders the close button in the header. */48 onClose?: () => void;49 /** Locks the actions and swaps the Create label. */50 isBusy?: boolean;51 /** Panel heading. */52 title?: ReactNode;53 /** Description under the Neon Auth toggle. */54 authDescription?: ReactNode;55 /** Measured round-trips by region id, e.g. from useRegionPing. */56 latencies?: Record<string, number | null | undefined>;57 /** Hide the tilted globe under the map. */58 hideGlobe?: boolean;59 /** Inline field errors, e.g. from a rejected create request. */60 errors?: Partial<Record<"name" | "region", string>>;61};6263const DEFAULT_POSTGRES_VERSIONS = ["18", "17", "16"];6465/* Name generator: quiet adjective-noun pairs, Neon-style. */66const NAME_ADJECTIVES = [67 "misty",68 "quiet",69 "amber",70 "bold",71 "crimson",72 "dawn",73 "emerald",74 "frosty",75 "gentle",76 "hidden",77 "lunar",78 "polished",79 "rapid",80 "silent",81 "velvet",82 "wandering",83// … truncated
What it pulls in
npm packages
Other registry items
