Skip to content

How do you style an input field as required #4050

Closed Answered by saadeghi
TeaDrinkingProgrammer asked this question in Q&A
Discussion options

You must be logged in to vote

We don't force such style automatically, because there are different approaches in form design:

  • specifying optional inputs
  • or specifying required inputs
  • not specifying anything (for example if there's one text input only - it's obvious that it's required)

It depends on the form:
For example if you have 10 inputs and 9 of them are required, you wouldn't want to show required badge or a red asterisk next to 9 of them. Instead you would want to write Optional in front of one input.
If you have 10 inputs and one is required, you would want to show a required badge or a red asterisk next to that one input.

So we don't set a style automatically based on existence of required attribute.
Here a…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@TeaDrinkingProgrammer
Comment options

@saadeghi
Comment options

Answer selected by TeaDrinkingProgrammer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants