Fieldset
Groups related fields under a legend, with a shared hint and error.
Example
<focsd-fieldset label="Shipping address" hint="We only ship within the EU."> <focsd-text-field label="Street"></focsd-text-field> <focsd-text-field label="City"></focsd-text-field></focsd-fieldset>Usage
Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.
<script type="module"> import '@focsd-dev/components/focsd-fieldset.js';</script>
<focsd-fieldset label="Shipping address" hint="We only ship within the EU.">…</focsd-fieldset>import { Fieldset } from '@focsd-dev/react';
export function Example() { return <Fieldset label="Shipping address" hint="We only ship within the EU.">…</Fieldset>;}<script setup>import '@focsd-dev/components/focsd-fieldset.js';</script>
<template> <focsd-fieldset label="Shipping address" hint="We only ship within the EU.">…</focsd-fieldset></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/components/focsd-fieldset.js';
// template<focsd-fieldset label="Shipping address" hint="We only ship within the EU.">…</focsd-fieldset><script> import '@focsd-dev/components/focsd-fieldset.js';</script>
<focsd-fieldset label="Shipping address" hint="We only ship within the EU.">…</focsd-fieldset>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
label | label | string | — |
hint | hint | string | — |
error | error | string | undefined | — |
disabled | disabled | boolean | false |
name | name | string | — |
Slots
| Slot | Description |
|---|---|
(default) | Default content. |
CSS parts
Style the inside of the component with ::part(), for example focsd-fieldset::part(error).
| Part | Description |
|---|---|
error | The error element. |
fieldset | The fieldset element. |
hint | The hint element. |
items | The container around the slotted controls. |
legend | The legend element. |
Accessibility
disableddisables every control inside (native or Focsd), leaving them out of validation and the form data, like a native fieldset. Controls you disabled yourself stay disabled when the fieldset is enabled again.- A shadow
<fieldset>with<legend>; screen readers announce the legend when focus enters the group.
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.