How to show/hide a component using actions in form?

As what the title said, I want to show or hide a specific component in the form builder but using the action not the toggle or checkbox.

Action::make('hide_upload')
    ->icon('heroicon-m-eye-slash')
    ->action(function () {
        // how to hide or show specific component here inside the form?
    });
Solution
Use the action to set a property in the class and use that property value to determine whether to hide or show the component maybe?
Was this page helpful?