Skip to content

Fieldset

A native fieldset element with an easily stylable legend.

Billing details

Anatomy

Import the component and assemble its parts:

vue
<script setup>
import { FieldsetLegend, FieldsetRoot } from 'base-ui-vue'
</script>

<template>
  <FieldsetRoot>
    <FieldsetLegend />
  </FieldsetRoot>
</template>

API reference

Root

Groups a shared legend with related controls. Renders a <fieldset> element.

PropTypeDefaultDescription
asstring | Component'fieldset'The element or component to use for the root node.
disabledbooleanfalseWhether the component should ignore user interaction.
classstring | ((state: State) => string)CSS class applied to the element, or a function that returns a class based on the component's state.
styleStyleValue | ((state: State) => StyleValue)Style applied to the element, or a function that returns a style object based on the component's state.
AttributeDescription
data-disabledPresent when the fieldset is disabled.

Legend

An accessible label that is automatically associated with the fieldset. Renders a <div> element.

PropTypeDefaultDescription
asstring | Component'div'The element or component to use for the root node.
idstringThe id attribute of the legend element. When set, overrides the auto-generated id.
classstring | ((state: State) => string)CSS class applied to the element, or a function that returns a class based on the component's state.
styleStyleValue | ((state: State) => StyleValue)Style applied to the element, or a function that returns a style object based on the component's state.
AttributeDescription
data-disabledPresent when the fieldset is disabled.