@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
42 lines (41 loc) • 1.47 kB
TypeScript
import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
import "../../core/index.js";
import { FieldProps } from "../field/field.js";
//#region src/components/native-select/use-native-select.d.ts
interface NativeSelectSharedItem extends Omit<HTMLProps<"option">, "children" | "label" | "value"> {
label: string;
}
interface NativeSelectItemWithValue extends NativeSelectSharedItem {
value?: HTMLProps<"option">["value"];
}
interface NativeSelectItemWithItems extends NativeSelectSharedItem {
items: NativeSelectItemWithValue[];
}
type NativeSelectItem = NativeSelectItemWithItems | NativeSelectItemWithValue;
interface UseNativeSelectProps extends HTMLProps<"select">, FieldProps {
/**
* If `true`, include placeholder in options.
*
* @default true
*/
includePlaceholder?: boolean;
/**
* If provided, generate options based on items.
*
* @default []
*/
items?: NativeSelectItem[];
/**
* The placeholder for select.
*/
placeholder?: string;
}
declare const useNativeSelect: (props?: UseNativeSelectProps) => {
getFieldProps: PropGetter<"select", undefined, undefined>;
getIconProps: PropGetter<"div", undefined, undefined>;
getRootProps: PropGetter<"div", undefined, undefined>;
};
type UseNativeSelectReturn = ReturnType<typeof useNativeSelect>;
//#endregion
export { NativeSelectItem, UseNativeSelectProps, UseNativeSelectReturn, useNativeSelect };
//# sourceMappingURL=use-native-select.d.ts.map