buondevid / custom-select-dropdown

A customisable dropdown to improve your UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Select Dropdown

A custom dropdown, with full functionalities, to customise your webpage

GIF demo of the component

This component was created using only HTML, SCSS and Vanilla JS.
It's a component that you can use in place of select element, since they are not very customisable. It's made out of a div wrapper and 2 children: a span and a ul. So its markup it's very simple. The style I chose is inspired to neumorphism.

πŸ”— Live preview: here

πŸ”— GitHub repo: here

How to πŸ”¬

The custom select has all the functionalities a normal select has:

  • It can get focused with mouse or keyboard (TAB)
  • It opens/close on click
  • It closes if you click out of it
  • It's keyboard responsive, in fact once you get focus on it:
    • You can use space to open/close the dropdown
    • You can use Arrow Up or Down to move through the options
    • You can use Escape or Enter to select and exit the select
  • It comes with a search function built in: just start type the option and you'll be redirected to the one matching your query.

Stack & Tools πŸ”¨

  • HTML
  • SCSS
  • JavaScript
  • VS Code + ESLint
  • Git & GitHub

What I learned πŸ“–

  • Learned how to hard code functionalities already built in HTML elements
  • Learned to style and code components
  • Discovered interesting properties (scrollIntoView, etc...)
  • Deepened debouncing pattern
  • Learned how to code a basic search function

What could be improved πŸ”

  • Modularity, to let it be installed and used through npm

Author

πŸ—Ώ buondevid --> GitHub

About

A customisable dropdown to improve your UI

License:MIT License


Languages

Language:JavaScript 40.1%Language:SCSS 39.7%Language:HTML 20.2%