Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

CompareInputs

Combobox in five frameworks

The same example, live in each framework. One core underneath, so they should behave the same.

Back to the Combobox docs

Live

React

Loading19.3.1

Loading React…

No event yet

Vue

Loading3.5.44

Loading Vue…

No event yet

Svelte

Loading5.57.3

Loading Svelte…

No event yet

Solid

Loading2.0.0-rc.21

Loading Solid…

No event yet

Angular

Loading22.2.4

Loading Angular…

No event yet

The attributes each framework puts on the open popup, read from the page.

AttributeReactVueSvelteSolidAngular
roleClosedClosedClosedClosedClosed
aria-modalClosedClosedClosedClosedClosed
aria-labelledbyClosedClosedClosedClosedClosed
data-openClosedClosedClosedClosedClosed

Nothing open. Open a tile to fill its column.

Each tile sets modal to false, so five popups can be open at once; that is why aria-modal reads absent.

The same example, in each framework

Each tile above runs this file.

Combobox.tsx
import { Combobox } from '@hamur/react/combobox'

const fruits = ['Apple', 'Banana', 'Cherry', 'Grape', 'Lemon', 'Mango', 'Orange', 'Peach', 'Pear']

export default function ComboboxExample() {
  return (
    <Combobox.Root items={fruits}>
      <label className="field">
        <span className="select-label">Choose a fruit</span>
        <Combobox.InputGroup className="combobox">
          <Combobox.Input className="combobox-input" placeholder="e.g. Apple" />
          <Combobox.Clear
            className="combobox-button"
            aria-label="Clear selection"
          >
            ×
          </Combobox.Clear>
          <Combobox.Trigger
            className="combobox-button"
            aria-label="Open popup"
          >
            <Combobox.Icon className="select-icon" />
          </Combobox.Trigger>
        </Combobox.InputGroup>
      </label>
      <Combobox.Portal>
        <Combobox.Positioner className="select-positioner" sideOffset={6}>
          <Combobox.Popup className="select-popup combobox-popup">
            <Combobox.Empty className="combobox-empty">
              No fruits found.
            </Combobox.Empty>
            <Combobox.List className="select-list">
              <Combobox.Collection>
                {(fruit: string) => (
                  <Combobox.Item
                    key={fruit}
                    value={fruit}
                    className="select-item"
                  >
                    <Combobox.ItemIndicator
                      className="select-item-indicator"
                    >
                      ✓
                    </Combobox.ItemIndicator>
                    <span className="select-item-text">{fruit}</span>
                  </Combobox.Item>
                )}
              </Combobox.Collection>
            </Combobox.List>
          </Combobox.Popup>
        </Combobox.Positioner>
      </Combobox.Portal>
    </Combobox.Root>
  )
}

Measured, per framework

The frameworks against each other only, on the same machine and the same example.

FrameworkTestsSizeOpenCloseMemory
React2,15063.7 KiB5.10 ms18.0 ms0.99 MiB
Vue2,14760.5 KiB5.50 ms17.9 ms2.39 MiB
Svelte2,13864.4 KiB10.4 ms18.1 ms2.51 MiB
Solid2,13863.1 KiB4.70 ms17.9 ms0.71 MiB
Angular1,91169.6 KiB6.40 ms18.5 ms0.79 MiB

Size is the gzip of the component's entry with core and dom. Open, Close and Memory are medians in Chromium 156 on Apple M3 Max, 35 runs per framework; Memory is what one open and close leaves on the heap. Tests are Combobox's passing tests in each framework's suites. [N] is a value not measured yet.

Same props, five spellings

The Combobox.Root names in each framework's own syntax.

PropReactVueSvelteSolidAngular
namenamenamenamename[name]
defaultValuedefaultValuedefault-valuedefaultValuedefaultValue[defaultValue]
valuevaluevaluevaluevalue[value]
onValueChangeeventonValueChange@value-changeonValueChangeonValueChange(valueChange)
defaultInputValuedefaultInputValuedefault-input-valuedefaultInputValuedefaultInputValue[defaultInputValue]
inputValueinputValueinput-valueinputValueinputValue[inputValue]
onInputValueChangeeventonInputValueChange@input-value-changeonInputValueChangeonInputValueChange(inputValueChange)
defaultOpendefaultOpendefault-opendefaultOpendefaultOpen[defaultOpen]
openopenopenopenopen[open]
onOpenChangeeventonOpenChange@open-changeonOpenChangeonOpenChange(openChange)
autoHighlightautoHighlightauto-highlightautoHighlightautoHighlight[autoHighlight]
highlightItemOnHoverhighlightItemOnHoverhighlight-item-on-hoverhighlightItemOnHoverhighlightItemOnHover[highlightItemOnHover]
actionsRefactionsRefactions-refactionsRefactionsRef[actionsRef]
autoCompleteautoCompleteauto-completeautoCompleteautoComplete[autoComplete]
filterfilterfilterfilterfilter[filter]
filteredItemsfilteredItemsfiltered-itemsfilteredItemsfilteredItems[filteredItems]
formformformformform[form]
gridgridgridgridgrid[grid]
inlineinlineinlineinlineinline[inline]
isItemEqualToValueisItemEqualToValueis-item-equal-to-valueisItemEqualToValueisItemEqualToValue[isItemEqualToValue]
itemToStringLabelitemToStringLabelitem-to-string-labelitemToStringLabelitemToStringLabel[itemToStringLabel]
itemToStringValueitemToStringValueitem-to-string-valueitemToStringValueitemToStringValue[itemToStringValue]
itemsitemsitemsitemsitems[items]
limitlimitlimitlimitlimit[limit]
localelocalelocalelocalelocale[locale]
loopFocusloopFocusloop-focusloopFocusloopFocus[loopFocus]
modalmodalmodalmodalmodal[modal]
multiplemultiplemultiplemultiplemultiple[multiple]
onItemHighlightedeventonItemHighlighted@item-highlightedonItemHighlightedonItemHighlighted(itemHighlighted)
onOpenChangeCompleteeventonOpenChangeComplete@open-change-completeonOpenChangeCompleteonOpenChangeComplete(openChangeComplete)
openOnInputClickopenOnInputClickopen-on-input-clickopenOnInputClickopenOnInputClick[openOnInputClick]
virtualizedvirtualizedvirtualizedvirtualizedvirtualized[virtualized]
disableddisableddisableddisableddisabled[disabled]
readOnlyreadOnlyread-onlyreadOnlyreadOnly[readOnly]
requiredrequiredrequiredrequiredrequired[required]
inputRefinputRefinput-refinputRefinputRef[inputRef]
ididididid[id]
childrenchildren#defaultchildrenchildrenng-content
isItemDisabledisItemDisabledis-item-disabledisItemDisabledisItemDisabled[isItemDisabled]