Ai Core
smoothui-registry/ai-coreFreeComponent
Shared AI state contract, per-state motion presets and microphone amplitude hooks for SmoothUI AI components.
Install it
npx shadcn@latest add https://www.smoothui.dev/r/ai-core.jsonSource
1"use client";23import {4 type MotionValue,5 useAnimationFrame,6 useMotionValue,7} from "motion/react";8import { useCallback, useEffect, useRef, useState } from "react";910/**11 * The single state contract shared by every SmoothUI AI component.12 *13 * Passing the same value to an orb, a prompt input and a tool card makes the14 * whole surface move as one organism instead of a set of independent widgets.15 */16export type AIState =17 | "idle"18 | "listening"19 | "thinking"20 | "streaming"21 | "done"22 | "error";2324/**25 * A behavioural hint each component expresses **in its own material**.26 *27 * Deliberately not an overlay. Bolting one shared graphic onto every orb makes28 * four different materials look like the same widget wearing a costume, and it29 * pushes literal iconography (a checkmark, a warning ring) onto pieces that are30 * decorative by nature. Instead: a shader warps, a canvas ring loses harmonics,31 * a character changes expression. Same vocabulary, different flesh.32 */33export type AIStateMotif =34 | "breathe"35 | "receive"36 | "scan"37 | "pulse"38 | "ping"39 | "fault";4041/** Semantic accent applied on top of the component's own palette. */42export type AIStateAccent = "success" | "danger" | null;4344/** Motion parameters a component reads to render a given {@link AIState}. */45export type AIStateMotion = {46 /** Semantic colour override, so status is carried by hue and not only motion. */47 accent: AIStateAccent;48 /** Outer bloom strength, 0–1. */49 glow: number;50 /** Palette hue rotation in degrees. Small shifts read as a mood change. */51 hueRotate: number;52 /** Overall motion energy, 0–1. Scales ambient loops and displacement. */53 intensity: number;54 /** Behavioural hint; each component expresses it in its own material. */55 motif: AIStateMotif;56 /** Seconds between discrete pulses, for rhythmic behaviour. */57 pulseSeconds: number;58 /**59 * How far a shader's domain warp pushes the field, 0–1. Low values read as a60 * calm surface; high values churn without the silhouette growing.61 */62 turbulence: number;63 /** Revolutions per second of the noise field — the slow tumble. */64 tumble: number;65 /** How much external amplitude reaches the surface, 0 = ignore it. */66 reactivity: number;67 /** Chroma multiplier. Below 1 desaturates. */68 saturation: number;69 /** Resting scale of the surface, 1 = no change. */70 scale: number;71 /** Ambient loop speed multiplier, 1 = the component's base tempo. */72 speed: number;73};7475/**76// … truncated
What it pulls in
npm packages
Files it writes
More from SmoothUI Registry
All 178 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Agent Avataragent-avatar | SmoothUI Registry | Components | Free | no deps | |
| Ai Approvalai-approval | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Artifactai-artifact | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Branchai-branch | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Citationai-citation | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Context Meterai-context-meter | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Conversationai-conversation | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Diffai-diff | SmoothUI Registry | Components | Free | 2 deps |
