A customizable and easy-to-use select control for React applications, designed to enhance user experience with smooth interactions and a variety of configuration options.
import type { JSX } from 'react'
import type { AralItem } from '@fe-case/aral-select'
import { AralSelect } from '@fe-case/aral-select'
function Page(): JSX.Element {
return (
<AralSelect
name={'_rick_and_morty_'}
getItemText={(item: AralItem) => item['name']}
getItemValue={(item: AralItem) => item['id']}
items={[]}
isMulti={true}
/>
)
}
id
- The unique ID to set on the Aral Select componentname
- The name of the HTML input (no input will be rendered in case of leaving this empty)defaultValue
- The default value(s) to be shown at startitems
- Array of items that populate the select menurequired
- Marks the value-holding input as required for form validationplaceholder
- Placeholder for the select valueisDisabled
- Disables the select controlisMulti
- Support multiple selected itemsisLoading
- Is the select control in a state of loading (async)disableHighlight
- Disables highlighting the search termenableDebugMode
- Enables inserting debug logs into the consolehideSelectedItems
- Hide the selected item from the select menucloseMenuOnSelect
- Close the select menu when the user selects an itemisMenuOpen
- Whether the select menu is openinputProps
- To set and/or overwrite existing HTML input attributesnoItemsMessage
- Text to display when there are no items to showloadItems
- The async function that fetches and returns the itemsloadingElement
- The custom loading componentmenuElement
- The custom menu componentitemElement
- The custom item componentgetItemText
- The function that extracts the text from the itemgetItemValue
- The function that extracts the value from the itemisItemDisabled
- The function that decides if the item must be in disabled state
MIT. Copyright (c) Huseyin ELMAS 2024.