@spark-web/select
Version:
--- title: Select storybookPath: forms-select--default isExperimentalPackage: false ---
35 lines (34 loc) • 1.48 kB
TypeScript
import type { DataAttributeMap } from '@spark-web/utils/internal';
import type { SelectHTMLAttributes } from 'react';
export declare type Option = {
/** Whether or not the option is disabled. */
disabled?: boolean;
/** Label for the option. */
label: string;
/** Value of the option. */
value: string | number;
};
export declare type Group = {
/** List of options for the group. */
options: Array<Option>;
/** Label for the group. */
label: string;
};
export declare type OptionsOrGroups = Array<Option | Group>;
export declare type NativeSelectProps = Pick<SelectHTMLAttributes<HTMLSelectElement>, 'defaultValue' | 'name' | 'onBlur' | 'onChange' | 'required' | 'value'>;
export declare type SelectProps = NativeSelectProps & {
/** Sets data attributes for the element. */
data?: DataAttributeMap;
/** The values that can be selected by the input. */
options: OptionsOrGroups;
/** Placeholder text for when the input does not have an initial value. */
placeholder?: string;
};
export declare const Select: import("react").ForwardRefExoticComponent<NativeSelectProps & {
/** Sets data attributes for the element. */
data?: DataAttributeMap | undefined;
/** The values that can be selected by the input. */
options: OptionsOrGroups;
/** Placeholder text for when the input does not have an initial value. */
placeholder?: string | undefined;
} & import("react").RefAttributes<HTMLSelectElement>>;