flowbite-react icon indicating copy to clipboard operation
flowbite-react copied to clipboard

Textarea and TextInput with isFocus

Open rluders opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

It is very useful if we could define the user focus to TextInput and Textarea.

Describe the solution you'd like Adding an extra props to the component interface:

isFocus?: boolean;

And then make it active when loaded:

useEffect(() => {
        if (isFocused) {
            input.current.focus();
        }
    }, []);

Describe alternatives you've considered n/a

Additional context Maybe it is necessary to validate the need to implement this to other components inside the FormControls.

rluders avatar Jun 02 '22 16:06 rluders

I think a valid solution would be to make it so you can pass refs to all of the form controls. That should be available at the very least since I know a lot of people are using controlled inputs in React still.

Someone made a PR recently that showed how to do that. So it should be very easy to make that change for all the form controls. Thoughts?

tulup-conner avatar Jul 31 '22 21:07 tulup-conner