Material 3 Components
The compose-material3 module provides ready-to-use Material 3 components that wrap RecorderState and PlayerState from the compose module.
Add the dependency
You also need the compose module for rememberRecorderState() and rememberPlayerState().
RecordAudioButton
A recording button with optional live waveform, permission handling, and error dialog:
When state.needsPermission is true, the button shows AudioPermissionButton instead of the record toggle. When state.error is set, an ErrorDialog is shown automatically.
The toggle button shows:
Microphone icon when idle
Stop icon while recording
Loading indicator while processing
PlayAudioButton
A playback button for a specific AudioRecording:
The button shows:
Play icon when ready or stopped
Stop icon while playing (acts as pause toggle via
state.toggle())Loading indicator while loading
A restart button when playing, paused, or finished
Errors are shown via ErrorDialog when state.error is set.
AudioPermissionButton
An icon button that reflects microphone permission state and requests access when needed:
This is used internally by RecordAudioButton when permission is required. You can also use it standalone in custom layouts.
ErrorDialog
A Material 3 dialog for displaying an AudioError:
RecordAudioButton and PlayAudioButton show this dialog automatically when their state has an error.
Complete example
Full recording UI using shared state holders:
Component reference
Component | Signature | Purpose |
|---|---|---|
|
| Recording toggle with optional waveform and permission flow |
|
| Playback controls for one recording |
|
| Permission request button |
|
| Display an |