How to 'preselect' text in a TextField so that typing something new immediately replaces the previous text?

Viewed 75

It is common practice in many UI situations to preselect the text displayed in a text editing field in such a way that if the user starts typing it immediately replaces the displayed text.

This can be useful for example in search field to show the previously searched text (for reuse or editing) while making it easy to search for a new text string simply by start typing.

I've searched for how to do this in TextField, but not found a way yet - is it possible?

1 Answers

We don't have a concept of pre-select and it isn't common in mobile where selection is awkward by comparison. A more common approach here is to have an X button next to the text field which clears the text field instantly. You can easily do it by just adding a button next to the field.

Related