# form-group component

The <form-group> component is used to add certain controls with a specific structure to a form. It is the easy way to organize the layout of input components and labels, and to provide the help text.

Note: The <form-group> currently is used only for the "fv--comparison-select-pdf-file-dialog".

# Codes Example

# Label Text

The label text of the form component is used to provide a description of an innput component.

# Label Text Layout

The label text for the form-group component provides three types of form layouts, ltr, rtl and ttb:

  • The ltr and rtl are horizontal layouts, and the label text and the input component display on the same line.
  • The ltr in layout is that the label text appears on the left side of the input component.
  • The rtl in layout is that the label text appears to the right of the input component.
  • The ttb is a vertical layout, means Top-To-Bottom, where the label text appears above the input component.

The following example demonstrates the effect of these three layouts:

# Label Delimiter

In the example above, the label delimiter : takes place automatically when the direction is set to ltr and ttb. If the delimiter sign is not required, you can include delimiter inside the <legend> tag but leave its value blank to hide it:

# Help Text

The help text is optional and is primarily used to display component descriptive information, and the content can be set through the description property, which supports i18n.

The following example shows the help text styles in the different layouts:

# Set Parameters Dynamically

The parameters of the form-group component can be dynamically modified via the template or js, see the following example:

# API

# form-group Component Templates

Example:

<form-group delimiter=":" direction="ltr" label="" description="">
    <input>
</form-group>

Descriptions for each property of the form-group:

Attribute Description Type The default value Version
delimiter The delimiter after the label text, invalid when direction is rtl string ':' 8.5.0
direction The way to lay out the label text and input components. 'ltr' | 'rtl' | 'ttb' 'ltr' 8.5.0
label Label text string '' 8.5.0
description The help text under the input component string '' 8.5.0

# Methods

form-group componets' methods

Method Description Version
setDelimiter(delimiter: string) Modify the delimiter 8.5.0
setDirection(direction: 'ltr' &#124; 'rtl' &#124; 'ttb') Modify the layout way 8.5.0
setLabel(label: string) Modify the label text 8.5.0
setDescription(description: string) Modify the help text 8.5.0

# Event

The form-group component does not define events.