Voice recorder
A mic that becomes a recording pill and then a playback chip; it never touches the microphone — the bars follow levels the app feeds.
Real scenarios
The component as it is used in a product — not a specimen grid.
Answering a ticket with your voice
Press the mic: the button becomes a recording pill — the clock rolls, pause holds it, stop hands you a playback chip you can scrub. Stop fires with the duration.
No permission prompt, ever — wire your real levels in by dispatching nx-record-level on the element.
A 30-second cap, growing the other way
align="end" suits toolbars pinned at a row’s far end; the pill stops by itself at the cap.
bars narrows the live wave; take-bars shapes the playback scrubber.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| max-duration | number | 0 | The max seconds to record (0 = unbounded); the mm:ss clock rolls in the page’s digits. |
| align | string | start | Which way the pill grows from the button. |
| bars / take-bars | int | 26 · 30 | Live recording bars and playback waveform blades. |
| events | — | — | nx-record-start · pause · resume · stop { duration, levels } · cancel · discard. |
Snippet
<x-nx::voice-recorder max-duration="90" align="end"
x-on:nx-record-stop="$wire.save('یادداشت صوتی: ' + $event.detail.duration + ' ثانیه')" />