Home > Software engineering >  How to disable direct input in Textfield with DropdownMenu composable?
How to disable direct input in Textfield with DropdownMenu composable?

Time:03-30

While using a DropdownMenu composable with a Textfield, how do I prevent the user from directly typing into the Textfield?

Setting the field's enabled parameter to false completely deactivates the field which is not desired.

CodePudding user response:

TextField has a parameter called readOnly, you can set it to true to prevent it from being modified.

readOnly controls the editable state of the TextField. When true, the text field can not be modified, however, a user can focus it and copy text from it. Read-only text fields are usually used to display pre-filled forms that user can not edit

  • Related