Skip to main content

Select (Item)

caution

All props/parameters are optional unless they are marked with an asterisk ( * ).

Example

import { components } from "replugged";
const { SelectItem } = components;

export function Settings(): React.ReactElement {
return (
<SelectItem
{...util.useSetting(cfg, "foo", "bar")}
options={[
{
label: "Option 1",
value: "option1",
},
{
label: "Option 2",
value: "option2",
},
]}>
Select title
</SelectItem>
);
}

Enums

EnumDescription
Select.LooksSelect styles
FILLED | CUSTOM

Props

NameTypeDefaultDescription
autoFocusbooleanfalseWhether the select is on focus
classNamestringComponent class name
clear() => voidFunction ran when the selection is cleared; works together with clearable; alias of onClear
clearablebooleanfalseWhether the selection is clearable from its button; works together with clear
closeOnSelectbooleantrueWhether to close the popout once selected an option
disabledbooleanfalseWhether the select is disabled; alias of isDisabled
hideIconbooleanfalseWhether the arrow icon is hidden
isDisabledbooleanfalseWhether the select is disabled; alias of disabled
isSelected* (value: string) => voidFunction ran to check if the option passed as a parameter is selectable; not necessary if value is passed
lookSelect.LooksSelect.Looks.FILLEDDefine the select style
maxVisibleItemsnumber7How many options are visible
onChange* (value: string) => voidFunction ran on selection change; alias of onSelect and select
onClear() => voidFunction ran when the selection is cleared; works together with clearable; alias of clear
onClose() => voidFunction ran when the popout got closed
onOpen() => voidFunction ran when the popout got opened
onSelect* (value: string) => voidFunction ran on selection change; alias of onChange and select
optionClassNamestringOption element class name
options* SelectOptionType[]Array of select options
placeholderstringSelectSelect placeholder text
popoutClassNamestringPopout element class name
popoutPositionTooltip.PositionsPopout position displayed on the select
popoutWidthnumberPopout width
renderOptionLabel(option: SelectOptionType) => stringFunction ran on option label element render, useful to customize labels
renderOptionValue(option: SelectOptionType[]) => stringFunction ran on option value element render, useful to customize values
select* (value: string) => voidFunction ran on selection change; alias of onChange and onSelect
serialize(value: string) => voidFunction ran to serialize the option
valuestringSelected option value

Types

SelectOptionType

NameTypeDefaultDescription
disabledbooleanfalseWhether the option is disabled
keystringOption key
label* stringOption name
value* stringOption value