Skip to main content

Fieldset Ready

Fieldset is used to group together several related form components and a label. The usage of this component helps to make these groups accessible for assistive technologies.

Fieldset consists of a mandatory label, and optionally a caption, tooltip, and error. It can be used to group together buttons, form fields, checkboxes, and similar components.

Examples #

Open in new window
<duet-fieldset label="Choose an option">
<duet-checkbox checked label="Option 1"></duet-checkbox>
<duet-checkbox label="Option 2"></duet-checkbox>
<duet-checkbox label="Option 3"></duet-checkbox>
</duet-fieldset>
Open in new window
<duet-fieldset
label="Travel dates"
caption="This is a caption lorem ipsum blah blah dulce est decorum est, pro patri amor"
>

<duet-tooltip slot="tooltip">Lorem ipsum</duet-tooltip>
<duet-date-picker label="Departure date"></duet-date-picker>
<duet-date-picker label="Return date"></duet-date-picker>
</duet-fieldset>

Properties #

Property Attribute Description Type Default
accessibleLiveError accessible-live-error The aria-live attribute for the error message. When the input is validated on blur, use "off", as using "polite" or "assertive" makes the screen reader read the error message twice. When the input is validated on submit, use "polite", as "off" would leave the messages unread by screen readers. Use "assertive" only in those rare cases when "polite" would leave the error message unread by screen readers. "assertive" | "off" | "polite" "polite"
caption caption Additional caption to show next to the label. string undefined
error error An error message to be shown next to the label. string undefined
label (required) label Label/legend displayed for the fieldset. string undefined
labelHeadingLevel label-heading-level Heading level for the label in the legend element. This is only used to give screen readers better logical structure. This does not affect visual appearance. "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" "span"
labelHidden label-hidden Visually hide the label, but still show it to screen readers. boolean false
margin margin Controls the margin of the component. "auto" | "none" "auto"
theme theme Theme of the fieldset. "" | "default" | "turva" ""

Slots #

Slot Description
"tooltip" Use to place a tooltip alongside the fieldset label.
"unnamed default slot" The component’s primary content. All child nodes that do not have a slot attribute defined are inserted into this primary slot.

Usage #

This section includes guidelines for designers and developers about the usage of this component in different contexts.

When to use #

  • When grouping several form controls as well as labels within a form.
  • When grouping several button components together.
  • When grouping several checkbox components together.
  • When grouping multiple checkbox type choices together.
  • When creating a date range picker.

When not to use #

Accessibility #

This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.


Integration

For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.

Integration guidelines


Tutorials

Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:

Tutorials

Building Layouts

Tutorials

Using CLI Tools

Tutorials

Creating Custom Patterns

Tutorials

Server Side Rendering

Tutorials

Sharing Prototypes

Tutorials

Usage With Markdown


Troubleshooting

If you experience any issues while using a component, please head over to the Support page for more guidelines and help.