shadcn.io is not affiliated with official shadcn/ui
Centered Voice Input Hero Block for React
A compact centred hero for a dictation app, with a voice input window in a hairline frame whose microphone starts and stops a live waveform.
Installation
Overview
A compact centred hero for products where the voice is the input. An announcement pill, a two-line headline, a sentence, a Shine Button and an outline button sit between solid page rails above a dictation window in a hairline frame with + marks on its corners. Its title bar carries the note's name and a pulsing "Listening…" status, its body the sentence being dictated, and its footer a round microphone beside a 24-bar waveform pulsing as if someone were speaking. The microphone is a real toggle, so a visitor can stop the preview and start it again. It's built from Announcement, Badge, Status, Status Pulse Text, Guides, Shine Button and Button, with Tailwind's CSS animations for the loops and your theme's tokens for every colour, and the copy is for Murmur, a fictional dictation app. For voice AI products, speech-to-text tools, dictation apps, accessibility platforms and any product where people talk instead of type.
FAQ
How do I change the waveform?
Edit WAVEFORM at the top of the file. Each bar has a height, its share of the waveform's height from 0 to 100, and a delay, where its pulse starts in milliseconds (a negative delay starts it part way through, so the bars never pulse in step). Add or remove bars to change the count. The bars are bg-foreground/70, so they follow your theme, and they spread across the window's footer; while the preview listens each one pulses with Tailwind's animate-pulse, sped up to 1.2 seconds.
What does the microphone button do?
It starts and stops the preview. It's a toggle button named "Listen" whose pressed state is announced: pressed, the ring swells out of it, the bars pulse and the status in the title bar reads "Listening…"; released, the ring and the pulsing stop, the bars settle flat and the status reads "Paused". The microphone is a secondary button, so the Shine Button stays the only primary control. It records nothing. It's also how a visitor stops the moving parts, which would otherwise loop for as long as the page is open.
How do I connect it to a real microphone?
Ask for the microphone with navigator.mediaDevices.getUserMedia({ audio: true }) when the button is pressed, never on load, and stop the stream's tracks when it's released. For bars that follow the voice, read an AnalyserNode's getByteFrequencyData on each animation frame and set each bar's height from it, instead of the pulse. Send the recording to your speech-to-text service, and show the transcript as text near the button.
Is the voice preview accessible?
Yes. The preview is a figure named "Voice input preview", and its one control is the microphone toggle, with a name and a pressed state. The waveform is hidden from screen readers, and the status is in words, not only in the dot's colour. The pill is a link, the headline is the page's h1, and with reduced motion nothing loops or fades in: the ring and the pulsing are gone and the bars stand still.
How does it fit on a phone?
The headline steps down from text-5xl to text-4xl, the two buttons wrap onto two lines when they don't fit side by side, and the pill's text truncates rather than overflowing. The window fills the column's width, up to max-w-xl, and the waveform's bars spread to fit beside the microphone on a 320px screen.
When should I use a voice input hero instead of a search bar or email capture?
Use the voice input hero when speaking is the main way people use your product: dictation, voice assistants, transcription or accessibility tools. The preview says "this product listens" before anyone reads the copy. Use a search bar hero for retrieval-first products such as docs sites or stores, and an email capture hero for waitlists and newsletters.
Related
- Pro
Centered Online Pulse Hero
Stats and live dataA centered showcase hero led by a live presence pill, a pulsing dot and a count of the people online, with two actions and a live project board in a band below.
- Pro
Split Search Bar Hero
Interactive demosA split hero whose call to action is a large search field with a Shine Button, popular searches, and, across a solid divider, a results panel that filters as you type.
- Pro
Centered Command Palette Mockup Hero
Product windowsA showcase hero for a keyboard-first issue tracker: a centred headline and two calls to action over a command palette drawn in a hairline frame.
- Pro
Split Layout Chat Skeleton Hero
Product windowsA split hero for an AI assistant: a headline, a Shine Button and a second action beside a chat app sketched in skeleton bars that runs off a tinted panel, closed by a band of three feature cells.
- Pro
Centered Email Capture Form Hero
Signup and waitlistA compact centered newsletter hero with the email field in a full-width band between two hairlines: a Shine Button subscribes, then a confirmation replaces the form, over a row of subscriber proof.
- Pro
Split Layout Before After Slider Hero
Interactive demosA split hero for a site speed tool: a headline, a Shine Button and a second action beside a speed report that fills its cell edge to edge, before on one side of a handle and after on the other.