"use client"; import { useActionState, useId } from "react"; import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { completeOnboardingAction, type OnboardingState } from "./actions"; const initialOnboardingState: OnboardingState = { attempt: 0 }; export function OnboardingForm() { const [state, formAction, pending] = useActionState( completeOnboardingAction, initialOnboardingState, ); // Bumping the key on each attempt forces uncontrolled inputs to remount with // the echoed defaultValue from the server — otherwise React's
); } function ModuleCheckbox({ name, label, description, defaultChecked, }: { name: string; label: string; description: string; defaultChecked?: boolean; }) { const id = useId(); const titleId = `${id}-title`; const descId = `${id}-desc`; return ( // The wrapping