FormField#
라벨 행(필수 표시 포함) · 입력 child · 그 아래 description 또는 error 를 세로로 쌓는 폼 필드 래퍼입니다.
Form 컴포넌트가 내부적으로 각 필드를 이 위젯으로 감쌉니다. Gap 간격은 CoreFormFieldStyle 의 nested CoreGapStyle
슬롯으로 흐릅니다. Flutter / Web 1:1 동일 API 입니다.
Live Preview#
Web
회사 이메일을 입력하세요.
Flutter
Loading Flutter...
class FormFieldDefaultExample extends StatelessComponent {
const FormFieldDefaultExample({super.key});
@override
Component build(BuildContext context) {
return div(
styles: Styles(raw: {'width': '320px'}),
[
FormField(
label: '이메일',
description: '회사 이메일을 입력하세요.',
required: true,
child: TextField(placeholder: Text('you@company.com')),
),
],
);
}
}
class FormFieldDefaultExample extends StatelessWidget {
const FormFieldDefaultExample({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
width: 320,
child: FormField(
label: '이메일',
description: '회사 이메일을 입력하세요.',
required: true,
child: TextField(placeholder: const Text('you@company.com')),
),
);
}
}
사용법#
// Flutter / Web 동일
FormField(
label: '이메일',
description: '회사 이메일을 입력하세요.',
required: true,
child: TextField(placeholder: const Text('you@company.com')),
)
Props#
| 파라미터 | 타입 | 기본값 | 설명 |
|---|---|---|---|
label | String? | null | 라벨 텍스트 |
labelWidget |
Widget / Component? |
null |
커스텀 라벨 위젯 (label 대신) |
child |
Widget / Component? |
null |
입력 위젯 |
error |
String? |
null |
에러 메시지 (있으면 description 대체) |
description |
String? |
null |
보조 설명 |
required |
bool |
false |
라벨에 필수 표시 |
enabled | bool | true | 활성/비활성 상태 |
formFieldStyle |
CoreFormFieldStyle? |
null |
색·간격·타이포 단일 진입점 (labelInputGapStyle 등 nested Gap 슬롯) |
FormControl도 유사한 라벨·에러·설명 래퍼지만,FormField가Form컴포넌트의 실제 필드 래퍼입니다.