AI Voice
kokonut-ui/ai-voiceFreeComponent
Voice mode.
Live preview
live · rendered by the registry
Rendered by kokonut-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://kokonutui.com/r/ai-voice.jsonSource
1"use client";23/**4 * @author: @kokonutui5 * @description: AI Voice6 * @version: 1.0.07 * @date: 2025-06-268 * @license: MIT9 * @website: https://kokonutui.com10 * @github: https://github.com/kokonut-labs/kokonutui11 */1213import { Mic } from "lucide-react";14import { useEffect, useState } from "react";15import { cn } from "@/lib/utils";1617export default function AI_Voice() {18 const [submitted, setSubmitted] = useState(false);19 const [time, setTime] = useState(0);20 const [isClient, setIsClient] = useState(false);21 const [isDemo, setIsDemo] = useState(true);2223 useEffect(() => {24 setIsClient(true);25 }, []);2627 useEffect(() => {28 let intervalId: NodeJS.Timeout;2930 if (submitted) {31 intervalId = setInterval(() => {32 setTime((t) => t + 1);33 }, 1000);34 } else {35 setTime(0);36 }3738 return () => clearInterval(intervalId);39 }, [submitted]);4041 const formatTime = (seconds: number) => {42 const mins = Math.floor(seconds / 60);43 const secs = seconds % 60;44 return `${mins.toString().padStart(2, "0")}:${secs45 .toString()46 .padStart(2, "0")}`;47 };4849 /**50 * Remove that, only used for demo51 */52 useEffect(() => {53 if (!isDemo) return;5455 let timeoutId: NodeJS.Timeout;56 const runAnimation = () => {57 setSubmitted(true);58 timeoutId = setTimeout(() => {59 setSubmitted(false);60 timeoutId = setTimeout(runAnimation, 1000);61 }, 3000);62 };6364 const initialTimeout = setTimeout(runAnimation, 100);65 return () => {66 clearTimeout(timeoutId);67 clearTimeout(initialTimeout);68 };69 }, [isDemo]);7071 const handleClick = () => {72 if (isDemo) {73 setIsDemo(false);74 setSubmitted(false);75 } else {76 setSubmitted((prev) => !prev);77 }78 };7980 return (81 <div className="w-full py-4">82 <div className="relative mx-auto flex w-full max-w-xl flex-col items-center gap-2">83 <button84 className={cn(85 "group flex h-16 w-16 items-center justify-center rounded-xl transition-colors",86 submitted87 ? "bg-none"88 : "bg-none hover:bg-black/5 dark:hover:bg-white/5"89 )}90 onClick={handleClick}91 type="button"92 >93 {submitted ? (94 <div95 className="pointer-events-auto h-6 w-6 animate-spin cursor-pointer rounded-sm bg-black dark:bg-white"96 style={{ animationDuration: "3s" }}97 />98 ) : (99// … truncated
What it pulls in
npm packages
Files it writes
More from kokonut-ui
All 40 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Action Search Baraction-search-bar | kokonut-ui | Components | Free | 2 deps · 2 files | |
| AI Input Searchai-input-search | kokonut-ui | Components | Free | 1 dep · 2 files | |
| AI State Loadingai-loading | kokonut-ui | Components | Free | 1 dep | |
| AI Input Selectorai-prompt | kokonut-ui | Components | Free | 2 deps · 4 files | |
| AI Text Loadingai-text-loading | kokonut-ui | Components | Free | 1 dep | |
| Apple Activity Cardapple-activity-card | kokonut-ui | Components | Free | 1 dep | |
| Magnet Buttonattract-button | kokonut-ui | Components | Free | 2 deps | |
| Avatar Pickeravatar-picker | kokonut-ui | Components | Free | 2 deps |
