jobiqo-cl
Version:
[](https://circleci.com/gh/jobiqo/jobiqo-cl)
51 lines (50 loc) • 1.23 kB
TypeScript
/**
* @file index.tsx
*
* @fileoverview Renders a normal select.
*/
import { FocusEvent } from 'react';
import { SelectItem } from '~/models/forms';
export interface SelectProps {
/**
* The id for this select. It will be used for accessibility purposes.
*/
id?: string;
/**
* Marks if a field is in an error state.
*
* @default false
*/
error?: boolean;
/**
* An array of selected items for the select.
*
* @default []
*/
items: SelectItem[];
/**
* The value that is selected.
*/
selectedValue?: string;
/**
* The label for the select.
*/
label?: string;
/**
* Description for this field.
*/
description?: string;
/**
* If the select is a required element.
*/
required?: boolean;
/**
* The event to fire when something changes in the select.
*/
onChange?(item: SelectItem): any;
/**
* The event to fire when the user clicks outside the select.
*/
onBlur?(event: FocusEvent<HTMLElement>): void;
}
export declare const Select: ({ id, items, label, description, error, required, onChange, onBlur, selectedValue }: SelectProps) => JSX.Element;