Vercel

Speech Input

Component 2

About

A microphone button that captures voice input and converts it to text using the Web Speech API, with a MediaRecorder fallback for browsers that lack native speech recognition.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Speech Input to your project and fits it to your theme.

Code

How Speech Input is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { SpeechInput } from "@/components/ui/speech-input";
import { useState } from "react";

export default function SpeechInputDemo() {
  const [transcript, setTranscript] = useState("");

  return (
    <div className="flex flex-col items-center gap-4">
      <SpeechInput onTranscriptionChange={(text) => setTranscript(text)} />
      <p className="text-muted-foreground text-sm">
        {transcript || "Click the microphone to start speaking"}
      </p>
    </div>
  );
}

Dependencies

More by Vercel

View all
  • Announcement

    Announcement

    290
  • Message

    Message

    48
  • Conversation

    Conversation

    42
  • Task

    Task

    41
  • Inline Citation

    Inline Citation

    36
  • Loader

    Loader

    22
  • Sources

    Sources

    20
  • Code Block

    Code Block

    12

Explore more