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
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled selected value |
onChange | (value: string) => void | — | Called with the selected value when changed |
options | SelectOption[] | — | List of options to display |
placeholder | string | "Select..." | Text shown when no value is selected |
disabled | boolean | false | Disables the dropdown |
SelectOption
| Field | Type | Description |
|---|---|---|
value | string | The value passed to onChange |
label | string | The text displayed in the dropdown |
Notes
- The dropdown renders via a portal so it always appears on top regardless of parent overflow settings.
- Since
onChangereturns astring, you'll need to cast it to your enum type when using it with a TypeScript union type as shown in the example above.