FieldGroup
Group related controls with legend, descriptions and coordinated validation.
Use the web element directly without the semantic runtime.
A registered presentation adapter can bind this component to host-owned meaning and state.
The standard recipe resolver does not select this component automatically.
Import and live example#
One legend and description wrapping a preferred-name field.
Interactive preview requires JavaScript.
View the complete example source
import {registerAeliqoElements} from "@varendo/web";
import {
AeliqoCheckboxElement,
AeliqoComboboxElement,
AeliqoDateFieldElement,
AeliqoDateRangeElement,
AeliqoFieldGroupElement,
AeliqoFileInputElement,
AeliqoFormElement,
AeliqoNumberFieldElement,
AeliqoRadioGroupElement,
AeliqoSearchFieldElement,
AeliqoSelectElement,
AeliqoSliderElement,
AeliqoSwitchElement,
AeliqoTextAreaElement,
AeliqoTextFieldElement,
type AeliqoOption,
} from "@varendo/web/inputs";
const options: readonly AeliqoOption[] = [
{value: "ada", label: "Ada Lovelace", description: "Research"},
{value: "grace", label: "Grace Hopper", description: "Product"},
{value: "lin", label: "Lin Chen", disabled: true},
];
registerAeliqoElements();
const host = document.querySelector<HTMLElement>("#aeliqo-example") ?? (() => {
const created = document.createElement("div");
created.id = "aeliqo-example";
(document.body ?? document.documentElement).append(created);
return created;
})();
function createCatalogRoot(container: HTMLElement): HTMLElement {
const root = document.createElement("div");
root.dataset.catalogSourceRoot = "true";
root.style.display = "grid";
root.style.gap = "12px";
container.append(root);
return root;
}
function createCatalogElement<T extends HTMLElement>(tagName: string, container: HTMLElement): T {
const element = document.createElement(tagName) as T;
element.setAttribute("data-aeliqo-theme", "light");
container.append(element);
return element;
}
function appendSlottedText(root: HTMLElement, slot: string, textContent: string): void {
const content = document.createElement("span");
content.slot = slot;
content.textContent = textContent;
root.append(content);
}
const root = createCatalogRoot(host);
(((root) => {
const group = createCatalogElement<AeliqoFieldGroupElement>("aeliqo-field-group", root);
group.legend = "Profile details";
group.description = "All fields are validated together.";
const field = document.createElement("aeliqo-text-field") as AeliqoTextFieldElement;
field.label = "Preferred name";
field.name = "preferredName";
group.append(field);
}))(root);
Purpose#
Groups related controls under one legend with shared description and error text. It can disable the whole fieldset while each child keeps its own value and validation.
When to use it#
- Several controls answer one question, such as the parts of an address.
- The group needs one legend plus shared description or error text.
- You want to disable a whole set of controls at once.
When to use a different component#
- Use Form when the controls also need submit and reset behavior.
- Use TextField or another single control when there is nothing to group.
Properties and defaults#
The group supplies shared semantics; child controls own their values and events.
| Property | Use and ownership | Declared type | Initial value |
|---|---|---|---|
legend | Provides the field-group legend announced before its child controls. | string | '' |
description | Provides supporting text associated with the control or value. | string | '' |
error | Provides the current validation or operation error associated with the control. | string | '' |
disabled | Prevents user interaction while keeping the control and its current value visible. | boolean | false |
Events#
- Child field events bubble
- No group-owned value event
States and failure handling#
Relevant states:
- ready
- disabled
- invalid
Expected result: The grouped field exposes one coherent legend and preserves child control semantics.
Keyboard, focus, and accessibility#
Keyboard behavior:
- Tab follows child field order
- IME composition in child fields
Exposed semantics:
- aria-describedby
- role
Responsive behavior#
Allow child controls to stack under the legend. Keep the legend and description visible above those controls.
Style hooks#
- Shadow parts:
description,error,group,legend - Varendo design tokens referenced:
--aeliqo-space-8,--aeliqo-typography-font-weight-semibold
Related components#
Generated TypeScript declaration#
View generated declaration
export declare class AeliqoFieldGroupElement extends AeliqoFoundationElement {
static readonly properties: {
legend: {
type: StringConstructor;
};
description: {
type: StringConstructor;
};
error: {
type: StringConstructor;
};
disabled: {
type: BooleanConstructor;
reflect: boolean;
};
};
legend: string;
description: string;
error: string;
disabled: boolean;
private readonly restoredDisabled;
private disabledObserver;
connectedCallback(): void;
disconnectedCallback(): void;
protected updated(changed: Map<PropertyKey, unknown>): void;
protected render(): import("lit").TemplateResult<1>;
private describedByIds;
private readonly handleSlotChange;
private syncDisabledDescendants;
static readonly styles: import("lit").CSSResult[];
}Version#
This page documents the Varendo 0.6 component contract.
