ctify

Select

Select fields components are used for collecting user provided information from a list of options.

Usage

Props

NameTypeDefaultDescription
labelReact.ReactNodeThe content to display as the label.
selectedKeyKeyThe currently selected key in the collection (controlled).
disabledKeysIterable<Key>The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.
isOpenbooleanfalseSets the open state of the menu.
isDisabledbooleanfalseWhether the input is disabled.
isRequiredbooleanfalseWhether user input is required on the input before form submission.
isInvalidbooleanfalseWhether the input value is invalid.
validationBehavioraria nativeariaWhether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.
validate(value: Key) => ValidationError trueA function that returns an error message if a given value is invalid. Validation errors are displayed to the user when the form is submitted if validationBehavior="native". For realtime validation, use the isInvalid prop instead.
variantfilled outlinedfilledThe type of the Select.
popoverPropsPopoverPropsProps that allow changing the popover placement, flip behavior, style etc.
classNamestring
styleReact.CSSProperties

Events

NameTypeDescription
onSelectionChange(key: Key) => voidHandler that is called when the selection changes.
onBlur(e: React.FocusEvent) => voidHandler that is called when the element loses focus.
onFocus(e: React.FocusEvent) => voidHandler that is called when the element receives focus.
onFocusChange(isFocused: boolean) => voidHandler that is called when the element's focus status changes.
onOpenChange(isOpened: boolean) => voidMethod that is called when the open state of the menu changes.