Control Field - React
import { ControlField } from '@sky-uk/ui-core';
The ControlField
component builds up a semantic grouping of inputs and adds information like labels and validation messages.
Sub Components
ControlField.Legend
– label of the input groupControlField.Layout
– grouping element for multiple LayoutControlField.Option
– input element with its labelControlField.Validation
– error message of the input groupControlField.Message
– inline message of the group
Using ControlField.Layout
with Radio Card.
Props
as
Either a RadioInput
, CheckboxInput
or RadioCard
component needs to be passed to the as
prop on each of the ControlField.Option
child components.
Checkbox
Radio
inlineMessage
ControlField.Option
can have an inline message, which could be set by inlineMessage
prop.
$legal
Add $legal
property to ControlField.Option
to set legal variant of the Checkbox. Legal variant of the label doesn't have an inline message.
state
Setting the state
prop to state="error"
on the ControlField
component will cause error styling to be applied.
You can add an error message in addition to the inline message of the input group.
System Modifiers
ControlField.Option
supports the following system functions: