Examples
Icon picker
Built with the mantine-combobox skill
Project settings
Choose an icon that makes this project easy to spot.
Selected value
null
Build an icon picker for the project settings page of a project management app. Every project has an icon that users choose from the full @tabler/icons-react set.
Trigger:
- a button-like input with the label "Project icon" that shows the selected icon and its name ("Rocket"); "Pick an icon" when nothing is selected
- the selected icon can be cleared
Dropdown:
- a search field at the top; search matches the icon name split into words ("arrow left" finds
IconArrowLeftandIconArrowBigLeft), case-insensitive, names that start with the query first - a switch between outline and filled icons; the filled set only contains icons that have a filled version
- icons are shown as a grid of square cells; hovering or highlighting a cell shows the icon name
- the grid shows thousands of icons, so it must render only the visible rows and stay smooth while scrolling and typing
- when the search is empty a "Recent" row with the last 8 picked icons is shown above the full grid
- "Nothing found" with the query when there are no matches
Keyboard:
- the search field keeps focus while the arrow keys move the highlighted cell in two directions: left and right move by one cell, up and down move by one row and keep the column, and the grid scrolls to keep the highlighted cell visible
- Home and End jump to the first and last cell, Page Up and Page Down move by one visible page
- Enter picks the highlighted icon and closes the dropdown; Escape closes it without changes
- opening the dropdown highlights the selected icon and scrolls to it
Value:
- the value is the icon name with its style (
{ name: 'Rocket', style: 'outline' }) or null; show the value as JSON under the picker
Write tests for the component.