Web Overlay

Select

A dropdown select component for choosing a single option.

Select is a dropdown component for choosing a single value from a list of options. It's commonly used for enum settings like box type or aimbot mode.

import { Select } from "@/components/select";

<Field name="Box Type">
  <Select
    value={data.boxes_type}
    onChange={(boxes_type) =>
      set({ ...data, boxes_type: boxes_type as "2d" | "3d" | "corner" })
    }
    options={[
      { value: "2d", label: "2D Box" },
      { value: "3d", label: "3D Box" },
      { value: "corner", label: "Corner Box" },
    ]}
  />
</Field>;

Props

PropTypeDefaultDescription
valuestringControlled selected value
onChange(value: string) => voidCalled with the selected value when changed
optionsSelectOption[]List of options to display
placeholderstring"Select..."Text shown when no value is selected
disabledbooleanfalseDisables the dropdown

SelectOption

FieldTypeDescription
valuestringThe value passed to onChange
labelstringThe text displayed in the dropdown

Notes

  • The dropdown renders via a portal so it always appears on top regardless of parent overflow settings.
  • Since onChange returns a string, you'll need to cast it to your enum type when using it with a TypeScript union type as shown in the example above.

On this page