import Hamburger from 'hamburger-react'
import { Squash as Hamburger } from 'hamburger-react'
import { Cross as Hamburger } from 'hamburger-react'
import { Twirl as Hamburger } from 'hamburger-react'
import { Fade as Hamburger } from 'hamburger-react'
import { Slant as Hamburger } from 'hamburger-react'
import { Spiral as Hamburger } from 'hamburger-react'
import { Divide as Hamburger } from 'hamburger-react'
import { Turn as Hamburger } from 'hamburger-react'
import { Pivot as Hamburger } from 'hamburger-react'
import { Sling as Hamburger } from 'hamburger-react'
import { Squeeze as Hamburger } from 'hamburger-react'
import { Spin as Hamburger } from 'hamburger-react'
import { Rotate as Hamburger } from 'hamburger-react'
$npm install hamburger-react
When using one hamburger, ~1.5 KB will be added to your bundle (min + gzip).
A way to provide your own state.
const [isOpen, setOpen] = useState(false)
<Hamburger toggled={isOpen} toggle={setOpen} />
A number between 12 and 48, which sets the size of the icon.
<Hamburger size={20} />
The animation direction of the icon, left or right.
<Hamburger direction="right" />
The duration of the animation. Can be set to zero if no animation is desired.
<Hamburger duration={0.8} />
The vertical distance between the lines. Small (sm), medium (md) or large (lg).
<Hamburger distance="lg" />
The color of the icon bars, accepts any CSS-parsable value.
<Hamburger color="#4FD1C5" />
A valid `transition-timing-function` CSS value.
<Hamburger easing="ease-in" />
A callback which receives a single boolean argument, indicating if the icon is toggled. This can be used to perform an action after toggling, or as an alternative to providing your own state. Inspect your browser console after tapping/clicking the example above.
<Hamburger onToggle={toggled => { if (toggled) { // open a menu } else { // close a menu }}} />
Specifies if the icon bars should be rounded.
<Hamburger rounded />
An ARIA label to improve accessibility.
<Hamburger label="Show menu" />
Hides the default browser focus style.
<Hamburger hideOutline={false} />
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.
Visit the GitHub repository for additional information about usage and the motivation behind this package.