Skip to content

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

CompareOverlays

Drawer in five frameworks

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

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

Drawer.tsx
import { Drawer } from '@hamur/react/drawer'

export default function DrawerExample() {
  return (
    <Drawer.Root swipeDirection="right">
      <Drawer.Trigger className="button">
        Open drawer
      </Drawer.Trigger>
      <Drawer.Portal>
        <Drawer.Backdrop className="backdrop drawer-backdrop" />
        <Drawer.Viewport className="drawer-viewport">
          <Drawer.Popup className="drawer">
            <Drawer.Content>
              <Drawer.Title className="dialog-title">
                Filters
              </Drawer.Title>
              <Drawer.Description className="muted">
                Narrow the list down. Swipe right or press Esc to close.
              </Drawer.Description>
              <div className="actions">
                <Drawer.Close className="button">
                  Done
                </Drawer.Close>
              </div>
            </Drawer.Content>
          </Drawer.Popup>
        </Drawer.Viewport>
      </Drawer.Portal>
    </Drawer.Root>
  )
}

Measured, per framework

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

FrameworkTestsSizeOpenCloseMemory
React57945.7 KiB1.90 ms2.20 ms0.78 MiB
Vue56741.9 KiB1.80 ms1.80 ms0.64 MiB
Svelte55344.5 KiB2.00 ms2.80 ms0.51 MiB
Solid53944.1 KiB2.00 ms1.50 ms0.44 MiB
Angular51345.8 KiB2.00 ms17.6 ms0.51 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 Drawer's passing tests in each framework's suites. [N] is a value not measured yet.

Same props, five spellings

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

PropReactVueSvelteSolidAngular
defaultOpendefaultOpendefault-opendefaultOpendefaultOpen[defaultOpen]
openopenopenopenopen[open]
onOpenChangeeventonOpenChange@open-changeonOpenChangeonOpenChange(openChange)
snapPointssnapPointssnap-pointssnapPointssnapPoints[snapPoints]
defaultSnapPointdefaultSnapPointdefault-snap-pointdefaultSnapPointdefaultSnapPoint[defaultSnapPoint]
snapPointsnapPointsnap-pointsnapPointsnapPoint[snapPoint]
onSnapPointChangeeventonSnapPointChange@snap-point-changeonSnapPointChangeonSnapPointChange(snapPointChange)
actionsRefactionsRefactions-refactionsRefactionsRef[actionsRef]
defaultTriggerIddefaultTriggerIddefault-trigger-iddefaultTriggerIddefaultTriggerId[defaultTriggerId]
disablePointerDismissaldisablePointerDismissaldisable-pointer-dismissaldisablePointerDismissaldisablePointerDismissal[disablePointerDismissal]
handlehandlehandlehandlehandle[handle]
modalmodalmodalmodalmodal[modal]
onOpenChangeCompleteeventonOpenChangeComplete@open-change-completeonOpenChangeCompleteonOpenChangeComplete(openChangeComplete)
snapToSequentialPointssnapToSequentialPointssnap-to-sequential-pointssnapToSequentialPointssnapToSequentialPoints[snapToSequentialPoints]
swipeDirectionswipeDirectionswipe-directionswipeDirectionswipeDirection[swipeDirection]
triggerIdtriggerIdtrigger-idtriggerIdtriggerId[triggerId]
childrenchildren#defaultchildrenchildrenng-content