diff --git a/apps/docs/package.json b/apps/docs/package.json index 310b5d0..fbf0d5f 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -12,6 +12,7 @@ "@ai-ui/tokens": "workspace:*", "@ai-ui/ui": "workspace:*", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "react-hook-form": "^7.71.2" } } diff --git a/apps/docs/src/components/form.stories.tsx b/apps/docs/src/components/form.stories.tsx new file mode 100644 index 0000000..21272da --- /dev/null +++ b/apps/docs/src/components/form.stories.tsx @@ -0,0 +1,187 @@ +import { + Button, + Form, + FormControl, + FormDescription, + FormItem, + FormLabel, + FormMessage, + Input, + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, + Switch, + Textarea +} from "@ai-ui/ui"; +import type { Meta, StoryObj } from "@storybook/react"; +import { Controller, useForm } from "react-hook-form"; +import { useState } from "react"; + +type LaunchFormValues = { + email: string; + notifications: boolean; + role: string; + summary: string; +}; + +function LaunchSettingsForm() { + const [submitted, setSubmitted] = useState(null); + const form = useForm({ + defaultValues: { + email: "", + notifications: true, + role: "design", + summary: "" + } + }); + + return ( +
+ { + setSubmitted(values); + })} + > +
+

+ Launch settings +

+

+ This story uses react-hook-form with the new form primitives. +

+
+ + + Email address + + + + Release notes and alerts will be sent here. + + + + ( + + Review lane + + + + + The selected team becomes the primary reviewer for this launch. + + + + )} + /> + + + Launch summary + +