Altinn / app-frontend-react

Altinn application React frontend
BSD 3-Clause "New" or "Revised" License
18 stars 31 forks source link

As an app developer I would like to style an input label as a header #189

Open Febakke opened 2 years ago

Febakke commented 2 years ago

Description

When designing simple forms where there are one question per page or pages where the input is the theme of the page it would be useful to combine the use of header and label. A page with just or normal labels will look empty and weird and you often end up using a header that contain the same information as the input label.

Gov.uk example

If this becomes a simple setting we should have H2 as the default header value.

Screenshots

image (10)

Specification tasks

Definition of done

mjulstein commented 2 years ago

@Magnusrm weren't you working on the inputs in the design-system? @haakemon do you think we should have label and input as separate components in the design-system?

haakemon commented 2 years ago

Label, description and fields are currently separate components, and rendered in separate grid items in app-frontend https://github.com/Altinn/app-frontend-react/blob/v3.44.0/src/altinn-app-frontend/src/components/GenericComponent.tsx#L348-L382

I guess this its done this way to allow long labels/descriptions together with short input fields (since inputfields take 100% width of the parent). Not sure we want to change this.

So input, label (and description) should likely be separate components in the Design system as well.