#Form State

1 messages · Page 1 of 1 (latest)

dawn swift
#

What's the best way to disable the submit button when the input field is empty? Right now I don't have any FE form state so I don't know what's the recommended approach.

still quail
#

I would recommend not disabling the submit button at all. Disabling usually means additional local state that you have to manage, and it can be perceived as a broken form to the user. Implementing some type of form validation may take extra effort up front, but you'll end up with a more flexible experience for yourself and more intuitive experience for the user.

I'm a fan of https://conform.guide/

naive lynx
#

Mark the input with required prop and let the browser handle it for you.