Hide element depending of the value of another element

Hello, do you know how can I hide an element depending of the value of another ?
private const TYPES = [
'text' => 'Texte',
'numeric' => 'Numérique',
'address' => 'Adresse',
'textarea' => 'Textarea',
'checkbox' => 'Checkbox',
'toggle' => 'Toggle',
'select' => 'Liste de sélection',
];


Forms\Components\Select::make('type')->options(self::TYPES)->label('Type du champs')->required(),
Forms\Components\TagsInput::make('options')->separator(',')
->hidden(
fn ($get): bool => $get('type') === 'Liste de sélection'
),
private const TYPES = [
'text' => 'Texte',
'numeric' => 'Numérique',
'address' => 'Adresse',
'textarea' => 'Textarea',
'checkbox' => 'Checkbox',
'toggle' => 'Toggle',
'select' => 'Liste de sélection',
];


Forms\Components\Select::make('type')->options(self::TYPES)->label('Type du champs')->required(),
Forms\Components\TagsInput::make('options')->separator(',')
->hidden(
fn ($get): bool => $get('type') === 'Liste de sélection'
),
3 Replies
LeandroFerreira
Select::make('type')->reactive()
Dan Harrin
Dan Harrin2y ago
fn ($get): bool => $get('type') === select'
SUNSHINE
SUNSHINEOP2y ago
Thanks, t's because it's not reactive 🙂
Want results from more Discord servers?
Add your server