Bedform UIControls

Select

Select an option from a native menu.

Select

Selected: creative
*
boolean
*
string
*
boolean

Usage

import { Select } from "@bedform/ui/select";
import { useState } from "react";

export function GameModeSelect() {
  const [value, setValue] = useState("creative");

  return (
    <>
      <label htmlFor="game-mode">Game mode</label>
      <Select
        id="game-mode"
        name="game-mode"
        value={value}
        onChange={(event) => setValue(event.currentTarget.value)}
      >
        <option value="survival">Survival</option>
        <option value="creative">Creative</option>
        <option value="adventure">Adventure</option>
        <option value="spectator" disabled>
          Spectator
        </option>
      </Select>
    </>
  );
}

Native behavior

The closed control uses the same OreUI surface and icon as the Dropdown trigger. The opened option panel is rendered by the browser and operating system, so its exact appearance is platform-dependent.

Use Select for plain text options. Use Dropdown only when options require custom content or a fully styled popup.

Forms and events

Select renders a native select, accepts every select attribute, and forwards its ref to it. disabled, required, name, value, validation, FormData, keyboard navigation, and form reset remain browser behavior. Use onChange or onInput as on any select.

CSS variables

VariablePurpose
--ore-select-unitBase size unit
--ore-select-background-defaultDefault surface
--ore-select-background-hoverHover surface
--ore-select-background-pressedPressed surface
--ore-select-highlight-defaultDefault highlight
--ore-select-borderOuter border
--ore-select-shadowBottom shadow
--ore-select-foregroundSelected text and chevron icon

On this page