voice-button-demo
elevenlabs/voice-button-demoFreeExample
shadcn/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/elevenlabs/ui/main/apps/www/public/r/voice-button-demo.jsonSource
1"use client"23import { useEffect, useState } from "react"45import { VoiceButton } from "@/components/ui/voice-button"67export default function VoiceButtonDemo() {8 const [state, setState] = useState<9 "idle" | "recording" | "processing" | "success" | "error"10 >("idle")1112 const handlePress = () => {13 if (state === "idle") {14 setState("recording")15 } else if (state === "recording") {16 setState("processing")1718 setTimeout(() => {19 setState("success")2021 setTimeout(() => {22 setState("idle")23 }, 1500)24 }, 1000)25 }26 }2728 useEffect(() => {29 const handleKeyDown = (e: KeyboardEvent) => {30 if (e.altKey && e.code === "Space") {31 e.preventDefault()32 handlePress()33 }34 }3536 window.addEventListener("keydown", handleKeyDown)37 return () => window.removeEventListener("keydown", handleKeyDown)38 }, [state])3940 return (41 <div className="flex min-h-[200px] w-full items-center justify-center">42 <VoiceButton43 label="Voice"44 trailing="⌥Space"45 state={state}46 onPress={handlePress}47 className="min-w-[180px]"48 />49 </div>50 )51}
What it pulls in
Other registry items
Files it writes
More from shadcn/ui
All 50 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| audio-player-demoaudio-player-demo | shadcn/ui | Examples | Free | no deps | |
| bar-visualizer-demobar-visualizer-demo | shadcn/ui | Examples | Free | no deps | |
| conversation-bar-democonversation-bar-demo | shadcn/ui | Examples | Free | no deps | |
| conversation-democonversation-demo | shadcn/ui | Examples | Free | no deps | |
| live-waveform-demolive-waveform-demo | shadcn/ui | Examples | Free | no deps | |
| matrix-demomatrix-demo | shadcn/ui | Examples | Free | no deps | |
| message-demomessage-demo | shadcn/ui | Examples | Free | no deps | |
| mic-selector-demomic-selector-demo | shadcn/ui | Examples | Free | no deps |
