remoteboy
remoteboy
FFilament
Created by remoteboy on 4/17/2024 in #❓┊help
Align a toggle to the right of a field
Oh nice
5 replies
FFilament
Created by remoteboy on 4/17/2024 in #❓┊help
Align a toggle to the right of a field
Went a different way with this in the end and used Form Actions to lock and unlock the field. Code needs a bit of refactoring but it looks like this now -
TextInput::make('slug')
->required()
->live($debounce = true)
->readOnly(function () use (&$isSlugReadOnly) {
return $isSlugReadOnly ? true : false;
})
->maxLength(255)
->suffixAction(
Action::make('allowSlugEdit')
->icon(function () use (&$isSlugReadOnly) {
return $isSlugReadOnly ? 'heroicon-m-lock-closed' : 'heroicon-m-lock-open';
})
->action(function () use (&$isSlugReadOnly) {
$isSlugReadOnly = !$isSlugReadOnly;
})
),
TextInput::make('slug')
->required()
->live($debounce = true)
->readOnly(function () use (&$isSlugReadOnly) {
return $isSlugReadOnly ? true : false;
})
->maxLength(255)
->suffixAction(
Action::make('allowSlugEdit')
->icon(function () use (&$isSlugReadOnly) {
return $isSlugReadOnly ? 'heroicon-m-lock-closed' : 'heroicon-m-lock-open';
})
->action(function () use (&$isSlugReadOnly) {
$isSlugReadOnly = !$isSlugReadOnly;
})
),
5 replies