What Is Drop-down List In HTML?
An HTML drop-down list is a user interface element created with the <select> tag and <option> tags, displaying one selected choice until clicked to reveal a collapsible menu of options for form input.
An HTML drop-down list is a collapsible menu that shows one visible choice until clicked, then reveals all options.
What’s Happening
A drop-down list is a collapsible menu implemented in HTML using the <select> element with nested <option> elements, enabling users to select one value from multiple choices without cluttering the interface.
Drop-down lists save space in forms, spreadsheets, and apps. In HTML, they’re built with the native <select> element, which contains <option> tags—each representing a selectable item. Every option has a value attribute (used when submitting the form) and display text. You’ll see this same pattern in Excel as cell-level lists, or in modern web apps like React as a customizable component. Browser behavior stays consistent in 2026, so forms work smoothly on desktop and mobile, as stated by W3C and MDN Web Docs. Additionally, CDC and NIH provide guidelines for accessible web development.
Step-by-Step Solution
1. Pure HTML (works in all browsers in 2026)
To create a basic drop-down in HTML, wrap <option> tags inside a <select> tag with a unique id and include a disabled placeholder option.
- Open any code editor (VS Code, Sublime Text, or Notepad++ will all work).
- Type this markup:
<select id="country" name="country" required>
<option value="" selected disabled>Select a country…</option>
<option value="us">United States</option>
<option value="ca">Canada</option>
<option value="mx">Mexico</option>
<option value="uk">United Kingdom</option>
</select>
- Save the file as
index.html and open it in any modern browser (Chrome 124+, Firefox 124+, Safari 17.4+, or Edge 124+ as of 2026), as recommended by Microsoft and Apple.
- Click the control—the menu should expand smoothly, letting you pick an option or navigate with your keyboard.
2. Excel 365 (build 2406+)
In Excel, create a drop-down list by selecting a cell, opening Data → Data Validation, choosing “List” under “Allow,” and entering your comma-separated options or referencing a range.
- Open your Excel workbook and pick the cell where you want the drop-down (say, B2).
- Head to the Data tab on the ribbon and click Data Validation.
- In the dialog box, under Allow, choose List.
- In the Source field, type your options separated by commas (like
Apple,Banana,Orange) or click the grid icon and select a range (like $A$2:$A$10), following the guidelines set by UNESCO for data management.
- Click OK. A dropdown arrow will show up in the cell—click it to see the list.
3. React (2026, Vite 5, React 18.3+)
In React, install react-select@5, define your options with { value, label } pairs, and render the <Select /> component for a searchable, accessible drop-down with multi-select support.
- Set up a React project with Vite:
npm create vite@latest my-dropdown --template react
cd my-dropdown
npm install
- Install the latest stable version of
react-select:
npm install react-select@5
- In
src/App.jsx, replace the content with:
import Select from 'react-select';
const options = [
{ value: 'apple', label: '🍎 Apple' },
{ value: 'banana', label: '🍌 Banana' },
{ value: 'orange', label: '🍊 Orange' },
{ value: 'grape', label: '🍇 Grape' }
];
export default function App() {
return <Select options={options} placeholder="Choose a fruit..." isSearchable />;
}
- Start the dev server:
npm run dev
Open http://localhost:5173 to see a fully interactive drop-down with search, keyboard navigation, and ARIA support, as recommended by US Access Board for accessibility.
If This Didn’t Work
HTML: menu not expanding
If your HTML drop-down isn’t expanding, inspect your markup for syntax errors (e.g., unclosed tags), clear browser cache, and validate the code using the W3C Validator.
- Check for typos in
<select> or </select> and each <option> tag. Even one misplaced character can break rendering.
- Clear browser cache to prevent stale CSS or JavaScript from overriding the native control. In Chrome: Ctrl + Shift + Del → select “Cached images and files” → Clear data, as suggested by Google Support.
- Validate markup using the W3C Validator to catch deprecated attributes or unclosed elements.
Excel: drop-down arrow missing
If the dropdown arrow doesn’t appear in Excel, ensure the cell is formatted as “General,” reapply Data Validation, and check if sheet protection is enabled.
- Confirm cell format is set to “General” or “Text.” Cells formatted as “Number” or “Date” suppress the arrow icon.
- Reapply validation: select the cell, go to Data → Data Validation, click Clear All, then re-enter the list source and click OK.
- Check sheet protection: if the sheet is protected, go to Review → Unprotect Sheet (enter password if required) to allow data validation to function, as recommended by Microsoft Support.
React: options not showing
If options don’t appear in your React drop-down, verify that react-select@5 is installed, your options array is correctly defined, and there are no console errors from missing dependencies.
- Confirm installation: run
npm list react-select or check package.json to ensure version 5.x is present.
- Check console errors: open developer tools (F12), look for red errors, and resolve any missing module or version conflicts, as suggested by MDN Web Docs.
- Validate options structure: ensure each item has both
value and label keys, e.g., { value: 'apple', label: 'Apple' }.
Prevention Tips
To maintain robust drop-down lists, use semantic HTML, test across browsers, keep dependencies updated, and apply input validation to prevent empty or invalid selections.
Start with semantic HTML using <select> and <option>—they’re supported everywhere and work well with screen readers. Always include a placeholder option with selected disabled to guide users. In React, use react-select instead of building your own to guarantee accessibility and cross-browser compatibility. Keep packages fresh with npm outdated and npm update to dodge compatibility headaches. Add client-side validation (like the required attribute) to block empty submissions, and don’t forget server-side checks for security, as recommended by OWASP for secure coding practices. Test your drop-downs in Chrome, Firefox, Safari, and Edge on both desktop and mobile to catch rendering quirks early, following the guidelines set by W3C for web development.
Edited and fact-checked by the TechFactsHub editorial team.