import { ReactElement } from "react"; import { BaseOptionType, SelectFieldProps } from "./FormFieldSelectAdapter"; /** * SelectField is a dropdown select component wrapped in the FormGroup component for selecting a single option from a list. * * ### When to use * Use SelectField when users need to choose one option from a predefined list of 4 or more items. * * ### When not to use * Do not use SelectField for fewer than 4 options. Use RadioGroup instead for better usability with small option sets. * * @example Basic select field * ```tsx * import { SelectField } from "@trackunit/react-form-components"; * import { useState } from "react"; * * const options = [ * { value: "us", label: "United States" }, * { value: "uk", label: "United Kingdom" }, * { value: "de", label: "Germany" }, * { value: "fr", label: "France" }, * ]; * * const MyForm = () => { * const [country, setCountry] = useState<{ value: string; label: string } | null>(null); * * return ( * setCountry(option)} * placeholder="Select a country" * /> * ); * }; * ``` * @example Async select field with search * ```tsx * import { SelectField } from "@trackunit/react-form-components"; * import { useState } from "react"; * * const MyAsyncForm = () => { * const [selected, setSelected] = useState(null); * * const loadOptions = async (inputValue: string) => { * const response = await fetch(`/api/users?search=${inputValue}`); * const users = await response.json(); * return users.map((user: { id: string; name: string }) => ({ * value: user.id, * label: user.name, * })); * }; * * return ( * * ); * }; * ``` * @param {SelectFieldProps} props - The props for the SelectField component */ export declare function SelectField({ ref, ...props }: SelectFieldProps): ReactElement; export declare namespace SelectField { var displayName: string; }