Wp-calypso: TokenField: Add placeholder text

Created on 18 Mar 2017  路  3Comments  路  Source: Automattic/wp-calypso

Enhancement request for TokenField https://wpcalypso.wordpress.com/devdocs/design/token-fields.

While working on https://github.com/Automattic/wp-calypso/pull/11809, I had the need to add placeholder text to the token field, to act as a more contextual description. I want it to be super clear that you have to comma separate here.

For a visual reference, the tokenfield is the one labeled Values:
screen shot 2017-03-17 at 4 19 49 pm

Is this something we could add? Curious to hear @aduth @mtias @MichaelArestad's thoughts.

Components [Type] Enhancement

Most helpful comment

I'd mentioned this being a pain, but after looking closer, there is an input being rendered by the component, it's just that the the selected tokens are shown outside of it. So to achieve a placeholder effect it might just be a matter of applying the placeholder prop only if there are currently no tokens assigned to the field. The condition is needed because the field is technically "empty" even if there are tokens assigned but if there is no in-progress text.

All 3 comments

I'm happy to handle this if it's something we want.

I'd mentioned this being a pain, but after looking closer, there is an input being rendered by the component, it's just that the the selected tokens are shown outside of it. So to achieve a placeholder effect it might just be a matter of applying the placeholder prop only if there are currently no tokens assigned to the field. The condition is needed because the field is technically "empty" even if there are tokens assigned but if there is no in-progress text.

Thanks, @aduth.

@justinshreve: Sounds good, I would say this would be great to add, but not ASAP. It would be good to have this in place for Variations before moving onto a different section.

Was this page helpful?
0 / 5 - 0 ratings