Altinn/app-frontend-react

Hint text in Dropdown and other input fields

Opened this issue · 1 comments

Description

When I create a dropdown there is often a need for having a hint text which shows the user what kind of options that appear if they press the dropdown list. A hint text could be "Velg politidistrikt.." and when the user presses it sees the kind of options, and if it is a required field it is not possible to leave it empty. Today you have to put this as a option in the list, but then you have to create custom validation to check if this option is selected.

Additional Information

Skjermbilde 2024-06-12 kl  10 38 34
I want it to be similar as the date field where there is a grey text, which only works as a hint to the user, and this should be a textResourceBinding e.g "hint" for Dropdown and also be great for all kinds of input fields.
Skjermbilde 2024-06-12 kl  10 30 32

Dette skal være støttet av designsystemet: https://storybook.designsystemet.no/?path=/story/komponenter-combobox--custom-new-value

Det heter 'placeholder' der, som er et begrep jeg tror jeg liker bedre enn 'hint', for det indikerer tydeligere at en placeholder faktisk forsvinner når en verdi er valgt (noe den riktignok ikke gjør i eksempelet til designsystemet, men det er fullt mulig å implementere det slik i app-frontend). Legger til good-first-issue på denne, da jeg tror det skal være en smal sak å implementere.