@coreui/react
Version:
UI Components Library for React.js
42 lines (41 loc) • 1.38 kB
TypeScript
import React, { ChangeEventHandler, InputHTMLAttributes } from 'react';
import { CFormControlWrapperProps } from './CFormControlWrapper';
type Option = {
disabled?: boolean;
label?: string;
selected?: boolean;
value?: string;
};
export interface CFormSelectProps extends CFormControlWrapperProps, Omit<InputHTMLAttributes<HTMLSelectElement>, 'size'> {
/**
* A string of all className you want applied to the component.
*/
className?: string;
/**
* Specifies the number of visible options in a drop-down list.
*/
htmlSize?: number;
/**
* Method called immediately after the `value` prop changes.
*/
onChange?: ChangeEventHandler<HTMLSelectElement>;
/**
* Options list of the select component. Available keys: `label`, `value`, `disabled`.
* Examples:
* - `options={[{ value: 'js', label: 'JavaScript' }, { value: 'html', label: 'HTML', disabled: true }]}`
* - `options={['js', 'html']}`
*/
options?: Option[] | string[];
/**
* Size the component small or large.
*/
size?: 'sm' | 'lg';
/**
* The `value` attribute of component.
*
* @controllable onChange
*/
value?: string | string[] | number;
}
export declare const CFormSelect: React.ForwardRefExoticComponent<CFormSelectProps & React.RefAttributes<HTMLSelectElement>>;
export {};