Dropdown 01
A clean baseline action menu — a compact icon trigger, icon-and-label items, and one dividing rule, with full keyboard and outside-click handling.
Requirements
HTML, CSS, JavaScript
Dependencies
None
Usage
Copy index.html, styles.css and script.js into your project.
Typography: Inter, with a system sans-serif fallback.
About Dropdown 01
Dropdown 01 is a dropdown component in the Dropdown Components collection, available in HTML + CSS + JavaScript and React + TypeScript + Tailwind CSS. Last updated September 13, 2026.
- dropdown
- menu
What the code includes
HTML + CSS + JavaScript
3 files: index.html, styles.css, script.js
- Behavior is handled in script.js.
- ARIA in the markup: roles menu, menuitem, separator; aria-haspopup, aria-expanded, aria-label.
- HTML elements used: button, svg.
- Keyboard keys handled: Escape, ArrowUp, ArrowDown, Home, End, Tab.
- Includes a prefers-reduced-motion rule for its animation.
React + TypeScript + Tailwind CSS
3 files: Dropdown01.jsx, Dropdown01.types.ts, Dropdown01.tailwind.css
- Configurable through 4 props: triggerLabel, items, defaultOpen, className.
- Uses React hooks: useEffect, useId, useLayoutEffect, useRef, useState.
- ARIA in the markup: roles menu, menuitem, separator; aria-haspopup, aria-expanded, aria-controls, aria-label.
- HTML elements used: button, svg.
- Keyboard keys handled: Escape, Enter, ArrowUp, ArrowDown, Home, End, Tab.
- Includes a prefers-reduced-motion rule for its animation.