Fieldset
NewGive related content a clear home with a labeled, optionally collapsible group.
Basic
A legend names the group and makes related details easier to scan.
Toggleable and controlled
Click the legend or use Enter/Space to expand and collapse. Form values are preserved while hidden.
Content is expanded. Legend is unlocked.
Custom header
Add an avatar and supporting text through a header template.
Initially collapsed
Keep secondary information available without distracting from the main task.
Usage and API
Import AvFieldset from avero-ui. Add AvFieldsetHeader when using the header directive.
HTML
<av-fieldset inputId="details" legend="Project details"
toggleable [(collapsed)]="collapsed">
<label for="project-name">Project name</label>
<input avInput id="project-name" />
</av-fieldset>State. Supply a unique inputId and a legend or header template. toggleable enables the legend button; [(collapsed)] synchronizes state. Without toggleable the content stays visible. disabled locks only the legend button; external updates and form fields remain available.
Templates and events. A direct child ng-template avFieldsetHeader or #header replaces the legend text. The directive takes precedence. onBeforeToggle and onAfterToggle emit originalEvent and the next collapsed state around a user toggle. External state updates do not emit these events. Content is eagerly created and preserved.
Accessibility. Native fieldset and legend group the content. The toggle is a button with aria-expanded and aria-controls. Customize its accessible name with toggleAriaLabel or toggleAriaLabelledBy. Keep toggleable header content presentational.