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?'),
Toggle::make('is_current_member')
->onColor('success')
->offColor('warning')
->inline() // Show label on the same line
->label('Current Member?'),
2 Replies
Wrax
Wrax2mo ago
Toggle does have disabled() iirc
Stricks
StricksOP2mo ago
🤦‍♂️ I thought I tried that. But it's working now - thank you!
Want results from more Discord servers?
Add your server