@yamada-ui/native-select
Version:
Yamada UI native select component
69 lines (66 loc) • 2.54 kB
TypeScript
import * as _yamada_ui_core from '@yamada-ui/core';
import { HTMLUIProps, ThemeProps } from '@yamada-ui/core';
import { FormControlOptions } from '@yamada-ui/form-control';
import { DetailedHTMLProps, OptionHTMLAttributes } from 'react';
interface NativeSelectBaseItem extends Omit<DetailedHTMLProps<OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>, "children" | "label" | "value"> {
label?: string;
}
type Value = DetailedHTMLProps<OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>["value"];
interface NativeSelectItemWithValue extends NativeSelectBaseItem {
value?: Value;
}
interface NativeSelectItemWithItems extends NativeSelectBaseItem {
items?: NativeSelectItemWithValue[];
}
interface NativeSelectItem extends NativeSelectItemWithValue, NativeSelectItemWithItems {
}
interface NativeSelectOptions {
/**
* The border color when the input is invalid.
*/
errorBorderColor?: string;
/**
* The border color when the input is focused.
*/
focusBorderColor?: string;
/**
* If provided, generate options based on items.
*
* @default '[]'
*/
items?: NativeSelectItem[];
/**
* The placeholder for select.
*/
placeholder?: string;
/**
* If `true`, include placeholders in options.
*
* @default true
*/
placeholderInOptions?: boolean;
/**
* Props for container element.
*/
containerProps?: Omit<HTMLUIProps, "children">;
/**
* Props for icon element.
*/
iconProps?: HTMLUIProps;
}
interface NativeSelectProps extends Omit<HTMLUIProps<"select">, "size">, ThemeProps<"NativeSelect">, NativeSelectOptions, FormControlOptions {
}
/**
* `NativeSelect` is a component used for allowing users to select one option from a list. It displays a native dropdown list provided by the browser (user agent).
*
* @see Docs https://yamada-ui.com/components/forms/native-select
*/
declare const NativeSelect: _yamada_ui_core.Component<"select", NativeSelectProps>;
interface NativeOptionGroupProps extends HTMLUIProps<"optgroup"> {
}
declare const NativeOptionGroup: _yamada_ui_core.Component<"optgroup", NativeOptionGroupProps>;
interface NativeOptionProps extends Omit<HTMLUIProps<"option">, "children"> {
children?: string;
}
declare const NativeOption: _yamada_ui_core.Component<"option", NativeOptionProps>;
export { NativeOption, NativeOptionGroup, type NativeOptionGroupProps, type NativeOptionProps, NativeSelect, type NativeSelectItem, type NativeSelectProps };