Possibility to have labels for fields

Hi all,

Is there a solution to be able to specify labels for fields in Single Type or Collection Type. Actually, the “name” of a field is the “internal” name (present in REST results) but it is also the label for the field, displayed for the user, it cannot contains space or special characters, and it could be more friendly to be able to specify a different text for the label than the field name.

Any solution ?

Thanks,

Xavier

System Information
  • Strapi Version: 3.6.6
  • Operating System:
  • Database:
  • Node Version: 13.14.0
  • NPM Version: 6.14.4
  • Yarn Version:

Hi Xnopre,
Welcome to the Strapi Community,
I use a dash between words when naming fields: address_line_1, which Strapi will display the label as Address_line_1, not the best in case of labels, but makes it easy enough to read. also be aware that the negative part of using underscores in names are that underscores are also used for filters on REST, which can cause errors sometimes.

Hey @xnopre

Our content-manager plugin already has the capability to modify the field name labels, see the following documentation: Configuring views of a content type - Strapi User Guide

When you build a content-type you should write the fields as you would expect them in the REST/GQL response either camelCase or snake_case.

1 Like

Hi @DMehaffy !

Thank you for your answer ! And good news ! I had seen and used the “Configure view”, but never seen that we can click on each field, with the possibility to set the label (my question), a description (good feature !), and a placeholder. Very good news !

But, if I’m not mistaken, this informations are only configurable online and stored in the database. Is it possible to set this informations in the code, as a developer ? without having to set this informations online (for a new field for example, to come with its label, description, and placeholder) ?

Thansk,

Regards,

Xavier

Not directly no but we do have a config dump/restore that dumps these (and only these for now + plugin settings) into a json format. See the following documentation for the CLI commands:

When you change in view setting it’s not save in json and when you deploy the label disappears