Fieldset
범례(legend), 설명, 액션과 함께 관련된 폼 컨트롤을 그룹화해요.
출처: HeroUI Fieldset
본문
사용법 (Usage)
import { Fieldset } from '@heroui/react';
{"component": "fieldset-basic"}
구조 (Anatomy)
import { Fieldset } from '@heroui/react';
export default () => (
<Fieldset>
<Fieldset.Legend />
<Fieldset.Group>
{/* form fields go here */}
</Fieldset.Group>
<Fieldset.Actions>
{/* action buttons go here */}
</Fieldset.Actions>
</Fieldset>
)
예시 (Examples)
서피스 내에서 (In Surface)
Surface 컴포넌트 안에서 사용할 때는 폼 컨트롤(Input, TextArea 등)에 variant="secondary" 를 사용해서 서피스 배경에 어울리는 낮은 강조 변형을 적용하세요.
{"component": "fieldset-on-surface"}
커스터마이징 (Customization)
Tailwind CSS
{"component": "fieldset-custom-styles"}
전역 CSS (Global CSS)
@layer components 디렉티브를 사용해서 Fieldset의 BEM 스타일 클래스를 지정하세요.
@layer components {
.fieldset {
@apply gap-5 rounded-xl border border-border/60 bg-surface p-6 shadow-field;
}
.fieldset__legend {
@apply text-lg font-semibold;
}
.fieldset__field-group {
@apply gap-3 md:grid md:grid-cols-2;
}
.fieldset__actions {
@apply flex justify-end gap-2 pt-2;
}
}
스타일링 참고 (Styling Reference)
HeroUI는 BEM 방법론을 따라 컴포넌트 변형과 상태를 재사용하고 커스터마이징하기 쉽게 만들어요.
CSS 클래스 (CSS Classes)
Fieldset 복합 컴포넌트는 다음 CSS 선택자를 노출해요:
기본 클래스 [!toc]
.fieldset– 루트 컨테이너.fieldset__legend– 범례 요소.fieldset__field-group– 그룹화된 필드의 래퍼.fieldset__actions– 필드 아래의 액션 바
API 참고 (API Reference)
Fieldset
| Prop | Type | Default | Description |
|---|---|---|---|
className |
string |
- | Tailwind CSS classes applied to the root element. |
children |
React.ReactNode |
- | Fieldset content (legend, groups, descriptions, actions). |
nativeProps |
React.HTMLAttributes<HTMLFieldSetElement> |
Supports native fieldset attributes and events. |
Fieldset.Legend
| Prop | Type | Default | Description |
|---|---|---|---|
className |
string |
- | Tailwind classes for the legend element. |
children |
React.ReactNode |
- | Legend content, usually plain text. |
nativeProps |
React.HTMLAttributes<HTMLLegendElement> |
- | Native legend attributes. |
Fieldset.Group
| Prop | Type | Default | Description |
|---|---|---|---|
className |
string |
- | Layout and spacing classes for grouped fields. |
children |
React.ReactNode |
- | Form controls to group inside the fieldset. |
nativeProps |
React.HTMLAttributes<HTMLDivElement> |
- | Native div attributes. |
Fieldset.Actions
| Prop | Type | Default | Description |
|---|---|---|---|
className |
string |
- | Tailwind classes to align action buttons or text. |
children |
React.ReactNode |
- | Action buttons or helper text. |
nativeProps |
React.HTMLAttributes<HTMLDivElement> |
- | Native div attributes. |