[ { "fileName": "SelectedStyles.tsx", "language": "tsx", "code": "import { useState } from 'react';\nimport { Combobox, Input, InputBase, useCombobox } from '@mantine/core';\nimport classes from './SelectedStyles.module.css';\n\nconst groceries = [\n '🍎 Apples',\n '🍌 Bananas',\n '🥦 Broccoli',\n '🥕 Carrots',\n '🍫 Chocolate',\n '🍇 Grapes',\n];\n\nexport function SelectedStyles() {\n const combobox = useCombobox({\n onDropdownClose: () => combobox.resetSelectedOption(),\n });\n\n const [value, setValue] = useState(null);\n\n const options = groceries.map((item, index) => (\n combobox.selectOption(index)}\n >\n {item}\n \n ));\n\n return (\n {\n setValue(val);\n combobox.closeDropdown();\n }}\n >\n \n }\n onClick={() => combobox.toggleDropdown()}\n rightSectionPointerEvents=\"none\"\n >\n {value || Pick value}\n \n \n\n combobox.resetSelectedOption()}>\n {options}\n \n \n );\n}\n" }, { "fileName": "SelectedStyles.module.css", "language": "css", "code": ".option {\n &[data-combobox-selected] {\n background-color: var(--mantine-color-red-9);\n color: var(--mantine-color-red-0);\n font-weight: 600;\n }\n}\n" } ]