ai-instructions
cult-ui/ai-instructionsUnverifiedComponent
Manage and toggle AI instructions with a popover, search, and create-dialog
Install it
npx shadcn@latest add https://raw.githubusercontent.com/nolly-studio/cult-ui/HEAD/apps/www/ai-instructions.jsonSource
1"use client"23import {4 createContext,5 useCallback,6 useContext,7 useMemo,8 useState,9 type ComponentProps,10 type PropsWithChildren,11 type ReactNode,12} from "react"13import {14 CheckmarkSquare02Icon,15 PlusSignIcon,16 SettingsIcon,17} from "@hugeicons/core-free-icons"18import { HugeiconsIcon } from "@hugeicons/react"1920import { cn } from "@/lib/utils"21import { Button } from "@/components/ui/button"22import {23 Command,24 CommandEmpty,25 CommandGroup,26 CommandInput,27 CommandItem,28 CommandList,29 CommandSeparator,30} from "@/components/ui/command"31import {32 Dialog,33 DialogClose,34 DialogContent,35 DialogDescription,36 DialogFooter,37 DialogHeader,38 DialogTitle,39 type DialogDescriptionProps,40 type DialogTitleProps,41} from "@/components/ui/dialog"42import {43 HoverCard,44 HoverCardContent,45 HoverCardTrigger,46} from "@/components/ui/hover-card"47import { Input } from "@/components/ui/input"48import {49 Popover,50 PopoverContent,51 PopoverTrigger,52} from "@/components/ui/popover"53import { Textarea } from "@/components/ui/textarea"5455// ============================================================================56// Types57// ============================================================================5859export interface Instruction {60 /** Unique identifier for the instruction */61 id: string62 /** Display title for the instruction */63 title: string64 /** Short description shown in the list */65 description: string66 /** Full instruction content shown in hover preview */67 content?: string68 /** Whether this is a user-created instruction */69 isCustom?: boolean70}7172export interface InstructionsContextValue {73 /** Currently active instruction IDs */74 activeIds: string[]75 /** Toggle an instruction's active state */76 toggle: (id: string) => void77 /** Check if an instruction is active */78 isActive: (id: string) => boolean79 /** All available instructions */80 instructions: Instruction[]81 /** Add a custom instruction */82 addCustom: (instruction: Omit<Instruction, "id" | "isCustom">) => void83 /** Remove a custom instruction */84 removeCustom: (id: string) => void85 /** Open state for the popover */86 open: boolean87 /** Set open state for the popover */88 setOpen: (open: boolean) => void89 /** Open state for the create dialog */90 createDialogOpen: boolean91 /** Set open state for the create dialog */92 setCreateDialogOpen: (open: boolean) => void93}9495// ============================================================================96// Context97// … truncated
What it pulls in
npm packages
Files it writes
More from cult/ui
All 157 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-instructions-demoai-instructions-demo | cult/ui | Components | Unverified | no deps | |
| animated-numberanimated-number | cult/ui | Components | Unverified | 1 dep | |
| animated-number-demoanimated-number-demo | cult/ui | Components | Unverified | no deps | |
| bg-animate-buttonbg-animate-button | cult/ui | Components | Unverified | no deps | |
| bg-animate-button-demobg-animate-button-demo | cult/ui | Components | Unverified | no deps | |
| bg-animated-fractal-dot-gridbg-animated-fractal-dot-grid | cult/ui | Components | Unverified | 1 dep | |
| bg-animated-fractal-dot-grid-demobg-animated-fractal-dot-grid-demo | cult/ui | Components | Unverified | no deps | |
| bg-animated-gradientbg-animated-gradient | cult/ui | Components | Unverified | 1 dep |
