Skip to main content

HTML5 Advanced layout customization

tip

For most projects, you DON'T need that level of customization. You should use CSS instead.

Set custom layout components

Concrete Form allows you to customize every single component used for layout.
These components need to be defined at the <Form /> level like so:

<Form layout={{
control: ...,
errors: ...,
itemLabel: ...,
itemsGroup: ...,
label: ...,
labelledControl: ...,
}}>
Your form content
</Form>

Available layout components

layoutdescription
control
Renders control and errors components
errors
Renders the field errors (to be injected in control)
itemLabel
Renders each item (control + label) in a group (ex: Checkbox or Radio)
itemsGroup
Renders a group of controls (items)
label
Renders a label inside LabelledControl
labelledControl
Renders a label and a control

Layout components props

Components will receive these props

control

NameTypeDescription
name string name of the control
control node Control component
errors node Errors component. (result of
errors
layout)

errors

NameTypeDescription
name string name of the control
errors string[] array of translated errors

itemLabel

NameTypeDescription
name string name of the control
control node control element (checkbox, radio, toggle switch, etc)
label node label of the control
labelPosition "top"
| "bottom"
| "left"
| "right"
position of the label

itemGroup

NameTypeDescription
name string name of the control
items node result of multiple
itemLabel

Note: this is a single node and not an array
label node label of the control
orientation "vertical" | "horizontal" orientation of the items

label

NameTypeDescription
label node label to render
htmlFor string | undefined "for" value to provide to the label (if available)

labelledControl

NameTypeDescription
control node result of
control
label node result of
label
labelPosition "top"
| "bottom"
| "left"
| "right"
position of the label (relative to the control)