Update TextInput programmatically in reactive way

Hello guys,

I have a reactive Select component on form and I want to update value of a TextInput based on the onchange value of this Select element.

I tried to use value() method, but it sets the value only once on load and doesn’t change on Select changes.

Please help.
Solution
Select::make('select')
    ->options([
        '1' => 'Option 1',
        '2' => 'Option 2',
    ])
    ->reactive()
    ->afterStateUpdated(fn ($state, $set) => $set('text', $state)),
TextInput::make('text')
Was this page helpful?