A wrapper that provides label, description, error, and constraint text for form controls. — <cs-form-field>
<cs-form-field label="Name" description="Your full name.">
<cs-input placeholder="John Doe"></cs-input>
</cs-form-field>
<cs-form-field label="Email" error-text="Invalid email.">
<cs-input type="email"></cs-input>
</cs-form-field>
__analytics-metadataAnalyticsMetadata__disable-guttersbooleanDisable the gutter applied by default.
__hide-labelbooleanVisually hide the label.
__styleCSSPropertiesanalytics-metadataFormFieldProps.AnalyticsMetadataSpecifies additional analytics-related metadata.
instanceIdentifier - A unique string that identifies this component instance in your application.errorContext - Identifies the error category and sub-category.character-count-textstringCharacter count constraint displayed adjacent to the constraintText. Use this to provide an updated character count on each keypress that is debounced for screen reader users.
control-idstring
default: generateUniqueId('formfield')The ID of the primary form control. You can use this to set the
for attribute of a label for accessibility.
If you don't set this property, the control group automatically sets the label to the ID of an inner form control (for example, an input component). This only works well if you're using a single control in the form field.
i18n-stringsFormFieldProps.I18nStringsAn object containing all the necessary localized strings required by the component.
stretchboolean
default: falseDetermines whether the primary control should expand to 12 columns.
By default (or when this property is set to false), the primary control
occupies 9 columns. The secondary control uses the remaining 3 columns.
On smaller viewports, both components occupy 12 columns and stack on top of each other.
If this property is set to true, the primary control uses the full
12 columns. The secondary control (if present) also uses 12 columns, and the two
controls stack on top of each other.
constraintTextConstraint text that's displayed below the control. Use this to provide additional information about valid formats, etc.
defaultThe primary form control (for example, input, textarea, etc.).
descriptionDetailed information about the form field that's displayed below the label.
errorTextText that displays as a validation error message. If this is set to a non-empty string, it will render the form field as invalid.
infoUse to display an 'Info' link next to the label.
labelThe main label for the form field.
secondaryControlA secondary control. You can use this for custom actions and content.
warningTextText that displays as a validation warning message. If this is set to a non-empty string, it will render the form field in a warning state.