FilamentF
Filament15mo ago
Stricks

Making a Form Toggle read-only

I have a boolean field that I'd like to show as a toggle button, but I'd like to disable the button so it's read-only. There doesn't appear to be an attribute to do this.

Or maybe I'm doing this the wrong way. Is there a better way to display a boolean and color code it?

My is_current_member boolean is a calculated field, so the user can't control it (thus the need for read-only).

I'm currently using this:
Toggle::make('is_current_member')
    ->onColor('success')
    ->offColor('warning')
    ->inline() // Show label on the same line
    ->label('Current Member?'),
Was this page helpful?