Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Official Placeholder support

Discussion in 'UI Toolkit' started by HugoBD-Unity, Oct 24, 2022.

  1. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    443
    Welcome to the discussion thread around the built-in Placeholder feature. As of 2023.1, placeholder is supported for TextFields and ValueTypeFields. In this thread, you’ll find examples of how to use the Placeholder, it’s also a good place to ask for help and share feedback.

    The clip below shows how to use the Placeholder property and override the default styles through the UI Builder.
    placeholder.gif

    The same can be achieved programmatically using the following APIs:

    Code (CSharp):
    1.  
    2. TextField.textEdition.placeholder
    3. TextField.textEdition.hidePlaceholderOnFocus
    4.  


    The USS classname when the placeholder is visible is:

    Code (USS):
    1. .unity-base-text-field__input--placeholder
     
    Last edited: Oct 24, 2022
    kayy, Mj-Kkaya, morepixels and 5 others like this.
  2. TeorikDeli

    TeorikDeli

    Joined:
    Apr 6, 2014
    Posts:
    117
    Nicee! Will this be backported to 2021.3 or 2022.x?
     
    oyenw likes this.
  3. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    443
    We are reluctant to backport features to ensure stability on earlier releases. So, unfortunately, there are currently no plans to backport.
     
  4. emredagwodo

    emredagwodo

    Joined:
    Oct 12, 2023
    Posts:
    1
    Great news! But we are using version 2022.3.x, it would be great if you could bring a retroactive update.