Skip to Content
文档

字段集

一组表单控件,可选择以通用名称分组。

SourceStorybookRecipeArk
Contact details
Please provide your contact details below.

用法

¥Usage

import { Fieldset } from "@chakra-ui/react"
<Fieldset.Root>
  <Fieldset.Legend />
  <Fieldset.Content />
</Fieldset.Root>

示例

¥Examples

已禁用

¥Disabled

使用 disabled 属性禁用字段集,从而禁用字段集中的所有输入元素。

¥Use the disabled prop to disable the fieldset to disable all input elements within the fieldset.

Shipping details

无效

¥Invalid

使用 invalid 属性将字段集标记为无效。这将显示错误文本。

¥Use the invalid prop to mark the fieldset as invalid. This will show the error text.

注意:你需要将 invalid 属性传递给 fieldset 中的 Field 组件,以使每个输入元素无效。

Shipping details
Some fields are invalid. Please check them.

属性

¥Props

PropDefaultType
colorPalette 'gray'
'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink'

The color palette of the component

size 'md'
'sm' | 'md' | 'lg'

The size of the component

as
React.ElementType

The underlying element to render.

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.
unstyled
boolean

Whether to remove the component's style.

invalid
boolean

Indicates whether the fieldset is invalid.

Previous

字段

Next

文件上传