TextBox DefaultText

As a Roblox developer, it is currently too hard to have a default value for TextBoxes. I have to create a TextLabel and write a script that will toggle its visibility depending on whether the user has written in the box. This feature is implemented by developers so frequently that it makes sense to have it built into the TextBox itself. An example would be the Roblox chat bar, “Press ‘/’ to begin chatting”.

Exact behavior would be as follows

  • If the box is not in focus and its text is “” then the DefaultText will be shown.
  • If the box is in focus and its text is “” then the DefaultText will not be shown.
  • If the user loses focus and the text is “” then DefaultText will be shown again.
  • If the user loses focus and the text it not “” then the DefaultText will not be shown.

It might also be worth adding DefaultTextColor to make it obvious there’s a difference between what the user has entered and the DefaultText.

28 Likes

Yes please!

Support, for sure.

The main use case for this is Command input (Please enter command sort of dialogue) - It’d be very handy as most solutions I see are buggy (even phantom forces)

1 Like

I like this idea.

When it comes to the name, calling it DefaultText makes it sound like the default value of the Text property. Maybe there’s a better name we could chose? In HTML, the term “Placeholder” is used for this in Input elements.

My DataStore Editor plugin uses a custom implementation of this, if anyone is curious at using it. It doesn’t seem buggy to me.

2 Likes

Indefinite support for this. Very useful feature.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

3 Likes

I think they mentioned this at RDC, not quite sure though

literally being added next week:

11 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.