Bug report
Current behavior
When using a raw value in Combobox.Item, the Combobox.Input renders the value as input value, instead of the label provided in <Combobox.Root items={[...]} />.
For example, selecting the item "Apple" here would result in the string "1" as input value:
<Combobox.Root items={[{ value: 1, label: 'Apple' }]} />
<Combobox.InputGroup>
<Combobox.Input />
</Combobox.InputGroup>
<Combobox.Portal>
<Combobox.Positioner>
<Combobox.Popup>
<Combobox.List>
<Combobox.Item value={1}>Apple</Combobox.Item>
</Combobox.List>
</Combobox.Popup>
</Combobox.Positioner>
</Combobox.Portal>
</Combobox.Root>
Expected behavior
When passing a raw value to Combobox.Item, and an array of { label: string; value: unknown; } as root items, the Combobox.Input should lookup the correct label for the selected value and use that label as input value automatically. This would align the behavior with how Select.Trigger already works.
I'm assuming the difference is because Select.Trigger uses Select.Value by default, and the logic I'm describing is implemented only by Select.Value and Combobox.Value.
Notably, when providing a raw default value without label (e.g. defaultValue={1}), the input does render the correct label. This is the expected behavior that should also apply when selecting a value from the popup.
Reproducible example
Link to StackBlitz
Base UI version
v1.4.0
Bug report
Current behavior
When using a raw value in
Combobox.Item, theCombobox.Inputrenders the value as input value, instead of the label provided in<Combobox.Root items={[...]} />.For example, selecting the item "Apple" here would result in the string "1" as input value:
Expected behavior
When passing a raw value to
Combobox.Item, and an array of{ label: string; value: unknown; }as root items, theCombobox.Inputshould lookup the correct label for the selected value and use that label as input value automatically. This would align the behavior with howSelect.Triggeralready works.I'm assuming the difference is because
Select.TriggerusesSelect.Valueby default, and the logic I'm describing is implemented only bySelect.ValueandCombobox.Value.Notably, when providing a raw default value without label (e.g.
defaultValue={1}), the input does render the correct label. This is the expected behavior that should also apply when selecting a value from the popup.Reproducible example
Link to StackBlitz
Base UI version
v1.4.0