Skip to content

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

CompareOverlays

Tour in five frameworks

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

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

Tour.tsx
import * as React from 'react'
import { Tour, type TourStep } from '@hamur/react/tour'

interface Copy {
  title: string
  body: string
}

function XIcon() {
  return (
    <svg className="tour-icon" viewBox="0 0 16 16" aria-hidden="true">
      <path d="M4 4l8 8M12 4l-8 8" />
    </svg>
  )
}

export default function TourExample() {
  const newFile = React.useRef<HTMLButtonElement>(null)
  const search = React.useRef<HTMLInputElement>(null)
  const settings = React.useRef<HTMLElement>(null)
  const steps = React.useMemo<TourStep<Copy>[]>(
    () => [
      {
        id: 'new-file',
        target: newFile,
        data: { title: 'Create a file', body: 'Start a blank document from the toolbar.' },
      },
      {
        id: 'search',
        target: search,
        data: { title: 'Find anything', body: 'Search file names and their contents.' },
      },
      {
        id: 'settings',
        target: settings,
        side: 'top',
        data: { title: 'Your settings', body: 'Turn autosave and sharing on or off here.' },
      },
    ],
    [],
  )
  return (
    <div className="tour-page">
      <div className="tour-toolbar">
        <button ref={newFile} type="button" className="button">
          New file
        </button>
        <input
          ref={search}
          className="input tour-search"
          aria-label="Search files"
          placeholder="Search files"
        />
      </div>
      <section ref={settings} className="tour-settings" aria-label="Settings">
        <label className="row">
          <input type="checkbox" defaultChecked />
          Autosave
        </label>
        <label className="row">
          <input type="checkbox" />
          Share with my team
        </label>
      </section>
      <Tour.Root steps={steps}>
        {({ step }) => (
          <>
            <Tour.Trigger className="button">
              Take the tour
            </Tour.Trigger>
            <Tour.Portal>
              <Tour.Backdrop className="backdrop" />
              <Tour.Spotlight className="tour-spotlight" />
              <Tour.Positioner className="tour-positioner">
                <Tour.Popup className="popover tour-popup">
                  <Tour.Arrow className="arrow" />
                  <div className="tour-head">
                    <Tour.Progress className="tour-progress" />
                    <Tour.Close className="tour-close" aria-label="Close tour">
                      <XIcon />
                    </Tour.Close>
                  </div>
                  <Tour.Title className="popover-title">
                    {step?.data?.title}
                  </Tour.Title>
                  <Tour.Description className="muted">
                    {step?.data?.body}
                  </Tour.Description>
                  <div className="tour-footer">
                    <Tour.Skip className="tour-skip" />
                    <Tour.Previous className="button" />
                    <Tour.Next className="button" />
                  </div>
                </Tour.Popup>
              </Tour.Positioner>
            </Tour.Portal>
          </>
        )}
      </Tour.Root>
    </div>
  )
}

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
Vue347Not measured yetNot measured yetNot measured yetNot measured yet
SvelteNot measured yetNot measured yetNot measured yetNot measured yetNot measured yet
Solid347Not measured yetNot measured yetNot measured yetNot measured yet
Angular351Not 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 Tour's passing tests in each framework's suites. [N] is a value not measured yet.

Same props, five spellings

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

PropReactVueSvelteSolidAngular
stepsstepsstepsstepssteps[steps]
defaultOpendefaultOpendefault-opendefaultOpendefaultOpen[defaultOpen]
openopenopenopenopen[open]
onOpenChangeeventonOpenChange@open-changeonOpenChangeonOpenChange(openChange)
onOpenChangeCompleteeventonOpenChangeComplete@open-change-completeonOpenChangeCompleteonOpenChangeComplete(openChangeComplete)
stepstepstepstepstep[step]
defaultStepdefaultStepdefault-stepdefaultStepdefaultStep[defaultStep]
onStepChangeeventonStepChange@step-changeonStepChangeonStepChange(stepChange)
modalmodalmodalmodalmodal[modal]
disablePointerDismissaldisablePointerDismissaldisable-pointer-dismissaldisablePointerDismissaldisablePointerDismissal[disablePointerDismissal]
disableTargetInteractiondisableTargetInteractiondisable-target-interactiondisableTargetInteractiondisableTargetInteraction[disableTargetInteraction]
keyboardNavigationkeyboardNavigationkeyboard-navigationkeyboardNavigationkeyboardNavigation[keyboardNavigation]
describeTargetdescribeTargetdescribe-targetdescribeTargetdescribeTarget[describeTarget]
spotlightPaddingspotlightPaddingspotlight-paddingspotlightPaddingspotlightPadding[spotlightPadding]
spotlightRadiusspotlightRadiusspotlight-radiusspotlightRadiusspotlightRadius[spotlightRadius]
targetTimeouttargetTimeouttarget-timeouttargetTimeouttargetTimeout[targetTimeout]
missingTargetmissingTargetmissing-targetmissingTargetmissingTarget[missingTarget]
labelslabelslabelslabelslabels[labels]
actionsRefactionsRefactions-refactionsRefactionsRef[actionsRef]
handlehandlehandlehandlehandle[handle]
childrenchildren#defaultchildrenchildrenng-content