Skip to content

Commit

Permalink
fix(combobox): placeholder only appears when there is no value on com…
Browse files Browse the repository at this point in the history
…bobox
  • Loading branch information
andresin87 committed May 13, 2024
1 parent 995926d commit 9a8215f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/components/combobox/src/ComboboxInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export const Input = forwardRef(
ref: inputRef,
})

const { selectedItems, selectedItem, multiple } = ctx

const hasPlaceholder = multiple ? selectedItems.length === 0 : selectedItem === null

return (
<>
{ariaLabel && (
Expand All @@ -86,7 +90,7 @@ export const Input = forwardRef(
<input
data-spark-component="combobox-input"
type="text"
placeholder={placeholder}
{...(hasPlaceholder && { placeholder })}
className={cx(
'max-w-full shrink-0 grow basis-[80px]',
'h-sz-28 text-ellipsis bg-surface px-sm text-body-1 outline-none',
Expand Down

0 comments on commit 9a8215f

Please sign in to comment.