Skip to content

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

CompareInputs

Color Picker in five frameworks

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

Back to the Color Picker 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.

ColorPicker.tsx
import { ColorPicker } from '@hamur/react/color-picker'
import { ColorSwatchPicker } from '@hamur/react/color-swatch-picker'
import { Field } from '@hamur/react/field'

const presets = ['#e5484d', '#f76b15', '#ffc53d', '#46a758', '#0090ff', '#8e4ec6']

export default function ColorPickerExample() {
  return (
    <Field.Root className="field">
      <Field.Label>Accent color</Field.Label>
      <ColorPicker.Root className="color-picker-row" defaultValue="#6699cc">
        <ColorPicker.Trigger className="button color-picker-trigger">
          <ColorPicker.Swatch className="color-swatch" />
        </ColorPicker.Trigger>
        <ColorPicker.Value className="color-picker-value" />
        <ColorPicker.Portal>
          <ColorPicker.Positioner sideOffset={8}>
            <ColorPicker.Popup className="popover color-picker-popup">
              <ColorPicker.Area className="color-picker-area">
                <ColorPicker.AreaThumb className="color-picker-thumb" />
              </ColorPicker.Area>
              <ColorPicker.ChannelSlider
                channel="hue"
                className="color-picker-slider"
              >
                <ColorPicker.ChannelSliderThumb
                  className="color-picker-thumb"
                />
              </ColorPicker.ChannelSlider>
              <ColorPicker.ChannelSlider
                channel="alpha"
                className="color-picker-slider color-picker-alpha"
              >
                <ColorPicker.ChannelSliderThumb
                  className="color-picker-thumb"
                />
              </ColorPicker.ChannelSlider>
              <ColorPicker.Input className="input color-picker-input" />
              <ColorSwatchPicker.Root className="color-swatch-picker" aria-label="Presets">
                {presets.map((color) => (
                  <ColorSwatchPicker.Item
                    key={color}
                    value={color}
                    className="color-swatch-picker-item"
                  />
                ))}
              </ColorSwatchPicker.Root>
              <ColorPicker.Close className="button">
                Done
              </ColorPicker.Close>
            </ColorPicker.Popup>
          </ColorPicker.Positioner>
        </ColorPicker.Portal>
      </ColorPicker.Root>
    </Field.Root>
  )
}

Measured, per framework

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

FrameworkTestsSizeOpenCloseMemory
ReactNot measured yetNot measured yetNot measured yetNot measured yetNot measured yet
VueNot measured yetNot measured yetNot measured yetNot measured yetNot measured yet
SvelteNot measured yetNot measured yetNot measured yetNot measured yetNot measured yet
SolidNot measured yetNot measured yetNot measured yetNot measured yetNot measured yet
Angular4Not measured yetNot measured yetNot measured yetNot measured yet

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; Memory is what one open and close leaves on the heap. Tests are Color Picker's passing tests in each framework's suites. [N] is a value not measured yet.

Same props, five spellings

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

PropReactVueSvelteSolidAngular
valuevaluevaluevaluevalue[value]
defaultValuedefaultValuedefault-valuedefaultValuedefaultValue[defaultValue]
onValueChangeeventonValueChange@value-changeonValueChangeonValueChange(valueChange)
onValueCommittedeventonValueCommitted@value-committedonValueCommittedonValueCommitted(valueCommitted)
formatformatformatformatformat[format]
colorSpacecolorSpacecolor-spacecolorSpacecolorSpace[colorSpace]
gamutgamutgamutgamutgamut[gamut]
openopenopenopenopen[open]
defaultOpendefaultOpendefault-opendefaultOpendefaultOpen[defaultOpen]
onOpenChangeeventonOpenChange@open-changeonOpenChangeonOpenChange(openChange)
onOpenChangeCompleteeventonOpenChangeComplete@open-change-completeonOpenChangeCompleteonOpenChangeComplete(openChangeComplete)
actionsRefactionsRefactions-refactionsRefactionsRef[actionsRef]
modalmodalmodalmodalmodal[modal]
disableddisableddisableddisableddisabled[disabled]
readOnlyreadOnlyread-onlyreadOnlyreadOnly[readOnly]
requiredrequiredrequiredrequiredrequired[required]
labelslabelslabelslabelslabels[labels]
getColorNamegetColorNameget-color-namegetColorNamegetColorName[getColorName]
localelocalelocalelocalelocale[locale]
namenamenamenamename[name]
formformformformform[form]
inputRefinputRefinput-refinputRefinputRef[inputRef]