© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
35 replies
Eric

Modify label in select options

Forms\Components\Select::make('song_id')
    ->relationship(name: 'song', titleAttribute: 'name')
Forms\Components\Select::make('song_id')
    ->relationship(name: 'song', titleAttribute: 'name')


id like to change the title attribute, i currently have it like this (song name):
Levels
Levels


but id like to show the artist too:
Avicii - Levels
Avicii - Levels


but idk how to do it hmmm
Solution
final code:
Forms\Components\Select::make('song_id')
    ->searchable()
    ->relationship(name: 'song', titleAttribute: 'name')
    ->required()
    ->getOptionLabelFromRecordUsing(function (Song $record) {
        $artistName = $record->artists()->first()?->name ?? '';

        return "{$artistName} - {$record->name}";
    })
,
Forms\Components\Select::make('song_id')
    ->searchable()
    ->relationship(name: 'song', titleAttribute: 'name')
    ->required()
    ->getOptionLabelFromRecordUsing(function (Song $record) {
        $artistName = $record->artists()->first()?->name ?? '';

        return "{$artistName} - {$record->name}";
    })
,


like this works fine
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Modify Label Options in RelationManager attach action
FilamentFFilament / ❓┊help
2y ago
How to modify options label on the attach action select.
FilamentFFilament / ❓┊help
3y ago
select options
FilamentFFilament / ❓┊help
3y ago
Select Options
FilamentFFilament / ❓┊help
3y ago