Library MCP Setup About Template Factory ↗
← Library / Forms UI SDK Agentic

Waitlist Capture Card

Accessible opt-in form built with UI SDK Field, Input, Select, Switch, and confirmed Submit Button so agents can fill fields and ask before submitting.

Install UI SDK & packages

npm install @ui-sdk/react @ui-sdk/core lucide-react

Give your agent the UI SDK skill

npx skills add vercel-labs/ui --skill ui-sdk

UI SDK entries: @ui-sdk/react/field @ui-sdk/react/input @ui-sdk/react/select @ui-sdk/react/switch @ui-sdk/react/button
"use client";

import * as React from "react";
import { CheckCircle2, Mail } from "lucide-react";
import { Button } from "@ui-sdk/react/button";
import { Field, FieldLabel } from "@ui-sdk/react/field";
import { Input } from "@ui-sdk/react/input";
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@ui-sdk/react/select";
import { Switch, SwitchThumb } from "@ui-sdk/react/switch";

export function WaitlistCaptureCard({
  onSubmit,
}: {
  onSubmit?: (payload: { email: string; stack: string; updates: boolean }) => void;
}) {
  const [email, setEmail] = React.useState("");
  const [stack, setStack] = React.useState("nextjs");
  const [updates, setUpdates] = React.useState(true);
  const [submitted, setSubmitted] = React.useState(false);

  const handleSubmit = (event?: React.FormEvent) => {
    event?.preventDefault();
    if (!email.trim()) return;
    onSubmit?.({ email: email.trim(), stack, updates });
    setSubmitted(true);
  };

  return (
    <div className="mx-auto w-full max-w-md rounded-2xl border border-border bg-card p-7 shadow-xl">
      <div className="inline-flex h-10 w-10 items-center justify-center rounded-xl bg-sky-400/15 text-sky-400">
        <Mail className="h-5 w-5" aria-hidden="true" />
      </div>
      <h3 className="mt-4 text-xl font-bold text-foreground">Get new Snow drops weekly</h3>
      <p className="mt-1.5 text-sm text-muted-foreground">
        Fresh agentic UI SDK components delivered once a week. Unsubscribe anytime.
      </p>

      {submitted ? (
        <div className="mt-6 flex items-center gap-2.5 rounded-xl border border-emerald-400/30 bg-emerald-400/10 p-4 text-sm font-semibold text-emerald-300">
          <CheckCircle2 className="h-5 w-5 shrink-0" aria-hidden="true" />
          <span>You are on the list. Watch your inbox!</span>
        </div>
      ) : (
        <form onSubmit={handleSubmit} className="mt-6 space-y-4">
          <Field name="email" className="space-y-1.5">
            <FieldLabel className="block text-xs font-semibold text-foreground">Work email</FieldLabel>
            <Input
              type="email"
              required
              value={email}
              onValueChange={setEmail}
              className="h-11 w-full rounded-xl border border-border bg-background px-3.5 text-sm text-foreground focus:border-sky-400 focus:outline-none"
            />
          </Field>

          <Field name="stack" className="space-y-1.5">
            <FieldLabel className="block text-xs font-semibold text-foreground">Primary stack</FieldLabel>
            <Select value={stack} onValueChange={(v) => v && setStack(v)}>
              <SelectTrigger className="flex h-11 w-full cursor-pointer items-center justify-between rounded-xl border border-border bg-background px-3.5 text-sm text-foreground">
                <SelectValue />
              </SelectTrigger>
              <SelectContent className="rounded-xl border border-border bg-card p-1 shadow-xl">
                <SelectItem value="nextjs" className="cursor-pointer rounded-lg px-3 py-2 text-sm data-highlighted:bg-secondary">
                  React + Next.js
                </SelectItem>
                <SelectItem value="vite" className="cursor-pointer rounded-lg px-3 py-2 text-sm data-highlighted:bg-secondary">
                  React + Vite
                </SelectItem>
                <SelectItem value="rails" className="cursor-pointer rounded-lg px-3 py-2 text-sm data-highlighted:bg-secondary">
                  Rails + React
                </SelectItem>
              </SelectContent>
            </Select>
          </Field>

          <Field className="flex items-center justify-between gap-3 pt-1">
            <FieldLabel className="text-xs font-medium text-muted-foreground">Product release notes</FieldLabel>
            <Switch
              checked={updates}
              onCheckedChange={setUpdates}
              className="relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border border-border bg-secondary p-0.5 transition data-checked:bg-sky-400"
            >
              <SwitchThumb className="h-4 w-4 rounded-full bg-white shadow transition-transform data-checked:translate-x-5" />
            </Switch>
          </Field>

          <Button
            type="submit"
            data-agent-confirm="Submits your email to join the waitlist"
            className="inline-flex h-11 w-full cursor-pointer items-center justify-center rounded-xl bg-sky-400 text-sm font-bold text-slate-950 transition hover:bg-sky-300"
          >
            Join waitlist
          </Button>
        </form>
      )}
    </div>
  );
}

export default WaitlistCaptureCard;