app-02
simple-ai/app-02FreeBlock
A persona generator app with structured outputs.
Live preview
live · rendered by the registry
Rendered by simple-ai on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://simple-ai.dev/r/app-02.jsonSource
1"use client";23import { experimental_useObject as useObject } from "@ai-sdk/react";4import { zodResolver } from "@hookform/resolvers/zod";5import { useState } from "react";6import { useForm } from "react-hook-form";7import { z } from "zod";8import { Button } from "@/components/ui/button";9import { Dialog, DialogContent } from "@/components/ui/dialog";10import { Input } from "@/components/ui/input";11import { Label } from "@/components/ui/label";12import { Textarea } from "@/components/ui/textarea";13import { PersonaDisplay } from "@/registry/blocks/app-02/components/persona-display";14import { getRandomExample } from "@/registry/blocks/app-02/lib/example-businesses";15import {16 formSchema,17 ProductPersonaSchema,18 UserPersonaSchema,19} from "@/registry/blocks/app-02/lib/persona";2021type FormData = z.infer<typeof formSchema>;2223export default function PersonaGenerator() {24 const [showDialog, setShowDialog] = useState(false);2526 const {27 register,28 handleSubmit,29 formState: { errors },30 reset,31 } = useForm<FormData>({32 resolver: zodResolver(formSchema),33 });3435 const { object, submit, isLoading } = useObject({36 api: "/api/ai/persona",37 schema: z.object({38 userPersona: UserPersonaSchema,39 productPersona: ProductPersonaSchema,40 }),41 });4243 const onSubmit = async (data: FormData) => {44 setShowDialog(true);45 submit(data);46 };4748 const handleRandomize = () => {49 const example = getRandomExample();50 reset(example);51 };5253 return (54 <div className="max-w-3xl mx-auto p-6 space-y-8">55 <div className="space-y-4 text-center">56 <h4 className="text-3xl font-bold tracking-tight">57 AI Persona Generator58 </h4>59 <p className="text-lg text-muted-foreground max-w-2xl mx-auto">60 Generate detailed user and product personas for your61 business using AI. Fill in the details below or try a random62 example to get started.63 </p>64 </div>6566 <div className="flex justify-end">67 <Button68 variant="outline"69 onClick={handleRandomize}70 className="group"71 >72 <span className="mr-2 group-hover:animate-spin">🎲</span>73 Try Random Example74 </Button>75 </div>7677 <div className="bg-card border rounded-lg p-6">78 <form onSubmit={handleSubmit(onSubmit)} className="space-y-6">79 <div className="grid gap-6 sm:grid-cols-2">80 <div className="space-y-2">81 <Label htmlFor="businessName">Business Name</Label>82 <Input83 id="businessName"84 {...register("businessName")}85// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from simple-ai
All 77 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| app-01app-01 | simple-ai | Blocks | Free | 5 deps · 11 files | |
| app-03app-03 | simple-ai | Blocks | Free | 4 deps · 9 files | |
| chat-01chat-01 | simple-ai | Blocks | Free | 3 deps · 16 files | |
| chat-02chat-02 | simple-ai | Blocks | Free | 2 deps · 3 files | |
| chat-03chat-03 | simple-ai | Blocks | Free | 2 deps · 3 files | |
| chat-04chat-04 | simple-ai | Blocks | Free | 3 deps · 13 files | |
| flow-chainflow-chain | simple-ai | Blocks | Free | 8 deps · 19 files | |
| flow-orchestratorflow-orchestrator | simple-ai | Blocks | Free | 8 deps · 19 files |
