Skip to content

Commit

Permalink
Update how allowArbitraryValue functions in comboboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
charliepark committed Oct 23, 2024
1 parent 4e96756 commit a747fe9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/ui/lib/Combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,21 @@ export const Combobox = ({
</ComboboxButton>
)}
</div>
{items.length > 0 && (
{(items.length > 0 || allowArbitraryValues) && (
<ComboboxOptions
anchor="bottom start"
// 14px gap is presumably because it's measured from inside the outline or something
className={`ox-menu pointer-events-auto ${zIndex} relative w-[calc(var(--input-width)+var(--button-width))] overflow-y-auto border !outline-none border-secondary [--anchor-gap:14px] empty:hidden`}
modal={false}
>
{allowArbitraryValues && filteredItems.length === 0 && (
<ComboboxOption value={query} className="relative">
<div className="ox-menu-item is-highlighted">
<span className="text-secondary">Use </span>
{query}
</div>
</ComboboxOption>
)}
{!allowArbitraryValues && filteredItems.length === 0 && (
<ComboboxOption disabled value="no-matches" className="relative">
<div className="ox-menu-item !text-disabled">No items match</div>
Expand Down

0 comments on commit a747fe9

Please sign in to comment.