import { ControlFieldSlotColumns, ControlFieldSlotLayout, FormFieldCounterColor, FormFieldDensity, FormFieldLabelSpacing, FormFieldLayout } from '@mezzanine-ui/core/form'; import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types'; import { IconDefinition } from '@mezzanine-ui/icons'; import { SeverityWithInfo } from '@mezzanine-ui/system/severity'; export interface FormFieldProps extends NativeElementPropsWithoutKeyAndRef<'div'> { /** * The counter text to display in the form field. * Typically used to show character count or remaining characters. */ counter?: string; /** * The color of the counter text. * @default FormFieldCounterColor.INFO */ counterColor?: FormFieldCounterColor; /** * The number of equal-width columns in the control field slot. * Children are laid out in a CSS Grid with equal-width columns; items wrap into additional rows as needed. * Omit this prop for single-column (default) layout. */ controlFieldSlotColumns?: ControlFieldSlotColumns; /** * The layout variant for the control field slot. * Controls the visual styling and appearance of the input control area. * @default ControlFieldSlotLayout.MAIN */ controlFieldSlotLayout?: ControlFieldSlotLayout; /** * To control the field passed from children whether should be disabled. * The form message won't appear if disabled. */ disabled?: boolean; /** * To control the field passed from children whether should be fullWidth. */ fullWidth?: boolean; /** * The hint text to display below the input field. * Provides additional information or guidance to the user. */ hintText?: string; /** * The icon to display alongside the hint text. */ hintTextIcon?: IconDefinition; /** * Whether to display the hint text icon. * When false, neither the custom icon nor the default severity icon will be shown. * @default true */ showHintTextIcon?: boolean; /** * The label text for the form field. */ label?: string; /** * The icon to display next to the label. * When provided, displays an icon that shows a tooltip on hover. */ labelInformationIcon?: IconDefinition; /** * The tooltip text to display when hovering over the label information icon. * Only shown when labelInformationIcon is provided. */ labelInformationText?: string; /** * Optional marker text to display after the label. * Typically used to show "(optional)" or similar text. */ labelOptionalMarker?: string; /** * The spacing variant for the label area. * Controls the padding and min-height of the label. * Only applicable when layout is 'horizontal' or 'stretch'. * Ignored when layout is 'vertical'. * @default FormFieldLabelSpacing.MAIN */ labelSpacing?: FormFieldLabelSpacing; /** * The layout variant of the form field. * Controls the arrangement direction of label and input. * When set to 'vertical', density and labelSpacing are ignored. * @default FormFieldLayout.HORIZONTAL */ layout?: FormFieldLayout; /** * The density variant of the form field. * Controls the width of label and max-width of data entry. * Only applicable when layout is 'horizontal' or 'stretch'. * Ignored when layout is 'vertical'. */ density?: FormFieldDensity; /** * The name attribute for the form field. * Used to identify the field in form submissions and as htmlFor in the label. */ name: string; /** * To control the field passed from children whether should be required. */ required?: boolean; /** * The severity level of the form field. * Used to indicate the importance or urgency of the field. * @default 'info' */ severity?: SeverityWithInfo; } /** * 表單欄位容器元件,整合標籤、提示文字與錯誤狀態。 * * 透過 `FormControlContext` 將 `disabled`、`required`、`severity` 等狀態向下傳遞給子元件。 * 支援水平、垂直與延伸三種排版方式,並可選擇性顯示字數計數器與提示文字圖示。 * 當 `disabled` 為 `true` 時,提示訊息將不會顯示。 * * @example * ```tsx * import FormField from '@mezzanine-ui/react/Form'; * import { TextField } from '@mezzanine-ui/react/TextField'; * * // 基本水平排版 * * * * * // 帶有錯誤提示的垂直排版 * * * * * // 帶有字數計數器 * * * * ``` * * @see {@link FormLabel} 表單標籤元件 * @see {@link FormHintText} 表單提示文字元件 * @see {@link FormControlContext} 表單控制狀態 Context */ declare const FormField: import("react").ForwardRefExoticComponent>; export default FormField;