Skip to content

feature: select drop down for icon - #34

Merged
dh1011 merged 2 commits into
dh1011:mainfrom
littlecorsican:select-drop-down-for-icon
Jun 6, 2026
Merged

feature: select drop down for icon#34
dh1011 merged 2 commits into
dh1011:mainfrom
littlecorsican:select-drop-down-for-icon

Conversation

@littlecorsican

@littlecorsican littlecorsican commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

I always thought its a bit inconvenient to have to go to material icon website to refer to the icon name and then input it by typing it into an input box.

i prefer a drop down select where user just select it. the list of icons is stored in /constant/materialDesignIcon. so that list can be extended if you want to add more options to it.

image

i would have preferred having a preview icon right beside the text in the drop down menu but this cant be done natively via html select, we need to use external library for that. maybe this can be considered in the future.

@dh1011

dh1011 commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR. I like the idea of making icon selection easier.

One small concern: changing the icon field to a fixed dropdown means users can only choose from the icons in the list. Right now, users can type any Material Design icon name, like food, even if it is not in the provided list.

Could we keep it as a text input, but still show suggestions while typing? A <datalist> should work well for this. It gives users suggested icons, but still lets them type any valid icon name.

Example:

const handleIconChange = (e: React.ChangeEvent<HTMLInputElement>) => {
  setIconInput(e.target.value);
  setIcon(e.target.value.toLowerCase());
};
<input
  id="icon"
  type="text"
  value={iconInput}
  onChange={handleIconChange}
  list="material-design-icons"
  autoComplete="off"
  placeholder="Enter Material Design Icon name"
  style={errors.icon ? { border: '1px solid #ff4444', boxShadow: '0 0 5px rgba(255, 68, 68, 0.3)' } : {}}
/>

<datalist id="material-design-icons">
  {MATERIAL_DESIGN_ICON_OPTIONS.map((iconOption) => (
    <option key={iconOption.value} value={iconOption.value}>
      {iconOption.label}
    </option>
  ))}
</datalist>

This way we get the helpful suggestions, but users can still enter any Material Design icon they want.

@littlecorsican

Copy link
Copy Markdown
Contributor Author
image

i made 1 commit for that. however i didnt use the value in the options, thought it look a bit goofy to have the value displayed.

@dh1011

dh1011 commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Perfect. Thank you.

@dh1011
dh1011 merged commit e91b42c into dh1011:main Jun 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants