<option>Link for this heading

January 6, 2025 · View on GitHub

The built-in browser <option> component lets you render an option inside a <select> box.

<select>

  <option value="someOption">Some option</option>

  <option value="otherOption">Other option</option>

</select>

The built-in browser <option> component lets you render an option inside a <select> box.

<select>

  <option value="someOption">Some option</option>

  <option value="otherOption">Other option</option>

</select>

See more examples below.

<option> supports all common element props.

Additionally, <option> supports these props:

  • React does not support the selected attribute on <option>. Instead, pass this option’s value to the parent <select defaultValue> for an uncontrolled select box, or <select value> for a controlled select.

Render a <select> with a list of <option> components inside to display a select box. Give each <option> a value representing the data to be submitted with the form.

Read more about displaying a <select> with a list of <option> components.

App.js

App.js

ResetFork

export default function FruitPicker() {
  return (
    <label>
      Pick a fruit:
      <select name="selectedFruit">
        <option value="apple">Apple</option>
        <option value="banana">Banana</option>
        <option value="orange">Orange</option>
      </select>
    </label>
  );
}

Previous<input>

Next<progress>


Copyright © Meta Platforms, Inc

no uwu plz

uwu?

Logo by@sawaratsuki1004

Learn React

Quick Start

Installation

Describing the UI

Adding Interactivity

Managing State

Escape Hatches

API Reference

React APIs

React DOM APIs

Community

Code of Conduct

Meet the Team

Docs Contributors

Acknowledgements

More

Blog

React Native

Privacy

Terms

On this page


React

v19

Search⌘CtrlK

Learn

Reference

Community

Blog

Is this page useful?

API Reference

Components