# Event registration form

> Event registration form with attendee details

A shadcn/ui block from the [@formscn](https://www.formscn.space) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/formscn/event-registration-form).

- Page, with a live preview: https://shadcn.exchange/r/formscn/event-registration-form
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/formscn/event-registration-form-light-e82fd9151cea121b.png
- Registry item: https://www.formscn.space/r/event-registration-form.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://www.formscn.space/r/event-registration-form.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `@hookform/resolvers`, `react-hook-form`, `sonner`, `zod`
- Registry items: `https://formscn.space/r/button.json`, `https://formscn.space/r/card.json`, `https://formscn.space/r/input.json`, `https://formscn.space/r/textarea.json`, `https://formscn.space/r/label.json`, `https://formscn.space/r/select.json`

## Files

### `src/registry/default/templates/event-registration-form.tsx`

```tsx
"use client";

import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import * as z from "zod";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { toast } from "sonner";

const formSchema = z.object({
  attendeeName: z.string().min(2, "Name is required"),
  attendeeEmail: z.string().email("Invalid email"),
  company: z.string().optional(),
  dietaryRestrictions: z.string().optional(),
});

type FormValues = z.infer<typeof formSchema>;

export function EventRegistrationForm() {
  const form = useForm<FormValues>({
    resolver: zodResolver(formSchema),
    defaultValues: {
      attendeeName: "",
      attendeeEmail: "",
      company: "",
      dietaryRestrictions: "",
    },
  });

  const onSubmit = async (data: FormValues) => {
    console.log("Form submitted:", data);
    toast.success("Successfully registered for the event!");
  };

  return (
    <Card className="w-full max-w-2xl mx-auto">
      <CardHeader>
        <CardTitle>Event Registration</CardTitle>
        <CardDescription>Register for our upcoming event</CardDescription>
      </CardHeader>
      <CardContent>
        <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
          <div className="space-y-2">
            <Label htmlFor="attendeeName">Full Name</Label>
            <Input
              id="attendeeName"
              placeholder="John Smith"
              {...form.register("attendeeName")}
            />
            {form.formState.errors.attendeeName && (
              <p className="text-sm text-destructive">{form.formState.errors.attendeeName.message}</p>
            )}
          </div>
          
          <div className="space-y-2">
            <Label htmlFor="attendeeEmail">Work Email</Label>
            <Input
              id="attendeeEmail"
              type="email"
              placeholder="john@company.com"
              {...form.register("attendeeEmail")}
            />
            {form.formState.errors.attendeeEmail && (
              <p className="text-sm text-destructive">{form.formState.errors.attendeeEmail.message}</p>
            )}
          </div>
          
          <div className="space-y-2">
            <Label htmlFor="company">Company Name</Label>
            <Input
              id="company"
              placeholder="Acme Inc."
              {...form.register("company")}
            />
          </div>
          
          <div className="space-y-2">
            <Label htmlFor="dietaryRestrictions">Dietary Requirements</Label>
            <Textarea
              id="dietaryRestrictions"
              placeholder="Vegetarian, Gluten-free, etc."
              className="min-h-[80px]"
              {...form.register("dietaryRestrictions")}
            />
            <p className="text-sm text-muted-foreground">
              Let us know if you have any food allergies
            </p>
          </div>

          <Button type="submit" className="w-full">Register Now</Button>
        </form>
      </CardContent>
    </Card>
  );
}
```
