# certara-form-group

<!-- Auto Generated Below -->


## Overview

A container for form elements that has a built-in label, required/optional indicators, error messages, and layout options

## Properties

| Property       | Attribute       | Description                                                                                                            | Type                        | Default     |
| -------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------- | --------------------------- | ----------- |
| `error`        | `error`         | Returns formatted error messages related to the field                                                                  | `string`                    | `''`        |
| `groupId`      | `group-id`      | Custom ID for the group element (used for aria-labelledby relationship)                                                | `string`                    | `undefined` |
| `hideLabel`    | `hide-label`    | Will visually hide the label                                                                                           | `boolean`                   | `false`     |
| `label`        | `label`         | Label that represents the form control                                                                                 | `string`                    | `undefined` |
| `layout`       | `layout`        | Place label adjacent to input controls, or stack them vertically                                                       | `"horizontal" \| "stacked"` | `'stacked'` |
| `showOptional` | `show-optional` | Indicator that a field is optional. If both showRequired and showOptional are true, showRequired will take precedence. | `boolean`                   | `false`     |
| `showRequired` | `show-required` | Indicator that a field is required                                                                                     | `boolean`                   | `false`     |
| `variant`      | `variant`       | Render container as a fieldset or as a div                                                                             | `"fieldset" \| "group"`     | `'group'`   |


## Methods

### `getLabelId() => Promise<string>`

Returns the label element's ID for aria-labelledby association

#### Returns

Type: `Promise<string>`



### `setFormControlId(id: string) => Promise<void>`



#### Parameters

| Name | Type     | Description |
| ---- | -------- | ----------- |
| `id` | `string` |             |

#### Returns

Type: `Promise<void>`




## Slots

| Slot           | Description                                                         |
| -------------- | ------------------------------------------------------------------- |
|                | Main content for help block                                         |
| `"help"`       | Additional descriptive text for the form-group                      |
| `"label-slot"` | Slot that supplements `label` attribute if rich content is required |


----------------------------------------------


