hamburger-qwik
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

Preview

Animated hamburger menu icons for Qwik

Hamburger menu icons for Qwik, with CSS-driven transitions. Created to be as elegant and performant as possible. This means no JavaScript animations, no transitions on non-cheap properties and a small size.

This package is a port of hamburger-react.

Installation

pnpm add hamburger-qwik

or

npm install hamburger-qwik

Size

When using one hamburger, ~1.5 KB will be added to your bundle (min + gzip).

Usage

Visit the website for full documentation, API and examples. A basic implementation looks as follows:

import Hamburger from 'hamburger-qwik';
const isOpen = useSignal(false);
<Hamburger toggle={isOpen} />

Or without providing your own state:

<Hamburger onToggle$={toggled => ...} />

Yet another hamburger library?

Yes. Since the creation of these burgers in 2015 a lot of similar ones have appeared, with one or more of the following downsides:

  • Animations that don't feel natural
  • Transitions on expensive properties (jerky animations)
  • No Qwik support
  • Size (additional dependencies besides Qwik or no tree shaking)
  • Not customizable, or too customizable (no sensible defaults)
  • Doing too much

Accessibility

It is recommended to have a tap/click area of at least 48x48 pixels. Therefore, padding will be added around the icon to create a surface of exactly this size.

Keyboard interaction is provided with the enter key, and the icon element has the recommended accessibility attributes (such as role). You can use the label property to supply an ARIA label for the icon.

Support

The icons are hooks-based, and will work with Qwik 1.0.0 ('the one with hooks') or higher.

Package Sidebar

Install

npm i hamburger-qwik

Weekly Downloads

82

Version

0.2.1

License

MIT

Unpacked Size

81.2 kB

Total Files

25

Last publish

Collaborators

  • gustavocadev