
Summary
Compact audio player featuring a modern “iMessage-style” voice note pill. Includes waveform visualization, play/pause controls, and optional looping. State is typically stored as a URL string to the audio file.| Class | Bjanczak\FilamentFlexFields\Filament\Forms\Components\AudioField |
| State type | string|null — audio URL (when not using static src()) |
| FieldType | audio |
| Playground | audio-field slug in Flex Fields playground |
Basic usage
Dynamic Audio (from State)
Static Audio (Fixed Source)
State & validation
Stored value
State is a string representing the audio URL.Validation rules (built-in)
Ensures the state is a valid media URL string.Configuration API
All methods acceptClosure unless noted.
| Method | Type | Default | Description |
|---|---|---|---|
src(string $src) | Setup | null | Fixed audio URL (overrides state) |
fullWidth(bool $condition) | Setup | false | Stretch player to container width |
loop(bool $condition) | Setup | false | Loop playback |
waveform(array $waveform) | Setup | default | Custom peak heights 8–100 |
playIcon(string $icon) | Setup | config | Custom play icon |
pauseIcon(string $icon) | Setup | config | Custom pause icon |
size(string $size) | Setup | 'md' | sm, md, lg |
readOnly(bool $condition) | Setup | false | Disable interaction |
rounding(string $rounding) | Setup | config | Border radius token |
Real-world examples
Post-Recording Preview
Fixed Demo Track
Playground
/admin/flex-fields-playground/audio-field
See Playground for setup.
Related components
| Component | When to use instead |
|---|---|
| VoiceNoteRecorderField | Record audio from the microphone |
| VideoField | Full video player with controls |
| FlexFileUpload | Standard file upload for audio files |
CSS classes (reference)
| Class | Role |
|---|---|
fff-audio-field-field | Root wrapper |
fff-audio-field-field--{sm|md|lg} | Size variant |
fff-audio-field__waveform | Waveform bars container |
fff-audio-field__bar | Individual waveform bar |
fff-audio-field__play | Play/pause button |
fff-audio-field__duration | Time display |