Fieldset Primitive
Fieldset is a Starwind Runtime primitive in the field-control-coordinator contract family.
Anatomy
Use the Astro primitive adapter to render Fieldset anatomy with the Runtime wiring included.
---import { Fieldset } from "@starwind-ui/astro/fieldset";---
<Fieldset.Root> <Fieldset.Legend>Preferences</Fieldset.Legend></Fieldset.Root>Use the React primitive adapter when Fieldset state participates in React rendering.
import { Fieldset } from "@starwind-ui/react/fieldset";
export function Example() { return ( <Fieldset.Root> <Fieldset.Legend>Preferences</Fieldset.Legend> </Fieldset.Root> );}Render the Fieldset data-sw-* contract yourself, then initialize createFieldset.
<fieldset data-sw-fieldset> <div data-sw-fieldset-legend>Preferences</div></fieldset>
<script type="module"> import { createFieldset } from "@starwind-ui/runtime/fieldset";
const root = document.querySelector("[data-sw-fieldset]"); if (root) { createFieldset(root); }</script>API Reference
Root
The main element that owns the Fieldset Runtime instance.
- Default element
- fieldset
- Discovery hook
- data-sw-fieldset
- Role
- -
Props
Prop Type Default Toggle
disabled boolean false
- Description
- Disables the Root part.
- Kind
- option
- Targets
- -
- Full type
- boolean
Data Attributes
Runtime hooks
Attribute Value Description
data-sw-fieldset - Marks the Root part so Starwind Runtime can find it.
Metadata
Attribute Value Description
data-disabled - Reflects the disabled prop on the Root part.
Legend
Legend text for the Fieldset fieldset.
- Default element
- div
- Discovery hook
- data-sw-fieldset-legend
- Role
- -
Data Attributes
Runtime hooks
Attribute Value Description
data-sw-fieldset-legend - Marks the Legend part so Starwind Runtime can find it.
Runtime API
- Factory
createFieldset- Import
@starwind-ui/runtime/fieldset- Root hook
- root
data-sw-fieldset - Option props
- disabled
Option Lifecycles
| Option | Lifecycle |
|---|---|
| disabled | setter-backed |
Runtime Setters
Method Target Description
setDisabled prop: disabled Updates whether Fieldset is disabled from Runtime code.
Related Styled Components
Component Relationship
Field Composite