© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
17 replies
Mark Chaney

CheckboxList description per option?

As far as I can tell, there is no way to have a longer description for each checkbox list item. Like a ->helperText() per option. I know you can use getOptionLabelFromRecordUsing(), but that doesnt allow HtmlString() as a return option, so can format the description at all. They are going to be 1-3 sentences, so not short. Trying out something like
    public function programCheckboxes(): array
    {
        return Program::all()->map(function ($program) {
            return Checkbox::make('programs[' . $program->id . ']')
                ->label($program->full_name)
                ->helperText(function () use ($program) {
                    if ($program->description) {
                        return new HtmlString('<div class="ml-7">' . $program->description . '</div>');
                    }
                    return null;
                });
        })->toArray();
    }
    public function programCheckboxes(): array
    {
        return Program::all()->map(function ($program) {
            return Checkbox::make('programs[' . $program->id . ']')
                ->label($program->full_name)
                ->helperText(function () use ($program) {
                    if ($program->description) {
                        return new HtmlString('<div class="ml-7">' . $program->description . '</div>');
                    }
                    return null;
                });
        })->toArray();
    }
, but i need to figure out the proper way to associate that, havent figured out the proper make() for that yet. Also means I have to recreate the ->bulkToggleable() functionality as well. Maybe i just need to extend the CheckboxList component? Sorry, thinking out loud here. lol.
Solution
well, a custom view with a hackish solution. lol
->getOptionLabelFromRecordUsing(fn(Program $record) => $record->full_name . '##' . $record->description)
->getOptionLabelFromRecordUsing(fn(Program $record) => $record->full_name . '##' . $record->description)
then in the view (amongst styling changes)
@php
    $customLabel = head(explode('##', $optionLabel));
    $customDescription = last(explode('##', $optionLabel));
@endphp
@php
    $customLabel = head(explode('##', $optionLabel));
    $customDescription = last(explode('##', $optionLabel));
@endphp
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

CheckboxList description with relationships
FilamentFFilament / ❓┊help
3mo ago
Set description for CheckboxList dynamically
FilamentFFilament / ❓┊help
2y ago
CheckboxList - set description from relationship record
FilamentFFilament / ❓┊help
3y ago
CheckboxList group options
FilamentFFilament / ❓┊help
3y ago