I was faced with the doubt as to the correct way to show an ID on a form. It will be a Read only field so the user can't edit or change the Id value.

So should I display this read only value in a input field or should I use another way, e.g. label, text?

Thanks in advance for your answers. MM


If the user can't interact, you have 2 ways:

  • use regular text
  • use a pre-filled, disabled field

In the first case, its main advantage is that the user can notice it's just a text and there's no affordance that suggest she can interact with that. However, if it's important, it might be overseen by the user

In the second case, it will be clear that this is part of the data that will be submitted with the form. However, it may cause a bit of friction if the user wants to interact with it, so you have to be very careful to style the disabled field in a way that the user realizes it's a disabled field.

One option is to add a text explaining the user why the field is disabled. Something like this (please note the example is non-accessible, I did it this way for exampel purposes so it's more clear, but you should follow accessibility rules):

enter image description here

Just in case, since I see you mention it, do not use labels. It goes against accessibility as well

  • 1
    Thanks a lot Devin thats the answer i want ;) – Miguel Marques May 6 at 18:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.