4.2.0 • Published 7 months ago

svelte-hamburgers v4.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

🍔 Svelte Hamburgers

Works with Svelte 3 & 4!

The ease to use Hamburger menu component for Svelte! Fully customisable with an extensive set of options, powered by a modified version of hamburgers.css.

Example of how to use svelte-hamburgers, view the repl here npm.io

Install

We will save it as a dev dependancy with -D

npm i svelte-hamburgers -D

How to use?

<script>
    import { Hamburger } from 'svelte-hamburgers';

    let open;
</script>

<Hamburger bind:open />

The open variable can be then used to handle your menu, for example:

{#if open}
    <!-- show menu -->
{/if}

Migrating

If you are migrating from 3.x.x to 4.x.x heres what you need to know:

  • CSS is now included! This means no more importing the css you need, you can remove the cdn tags you had before

  • The Hamburger component is a named import:

    <script>
        // Old way
        import Hamburger from 'svelte-hamburgers';
    
        // New way
        import { Hamburger } from 'svelte-hamburgers';
    </script>

Properties

You can use these to customise the hamburger, just provide them as props to the burger component, for example <Hamburger --color="white" />

PropertyTypeDefaultDescription
typestringspinThe type of burger you want, you can see the types here, it should be lowercase.
ariaLabelstringHamburger menuThe aria label of the burger.
--colorstringblackThe color of the burger.
--active-colorstringvalue of --colorThe color of the burger when active.
--paddingstring15pxThe padding.
--layer-widthstring30pxThe width of the burger.
--layer-heightstring2pxThe height of the burger.
--layer-spacingstring6pxThe spacing between layers of the burger.
--border-radiusstring4pxThe border radius of each burger part.
--hover-opacitynumber0.7The opacity amount on hover.
--hover-opacity-activenumbervalue of --hover-opacityThe opacity amount of hover when active.

Support

4.2.0

7 months ago

4.1.0

11 months ago

4.1.1

10 months ago

4.0.2

11 months ago

4.0.0-0

2 years ago

4.0.0-1

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

3.0.1

3 years ago

3.0.0

3 years ago

3.0.0-1

3 years ago

3.0.0-0

3 years ago

3.0.0-3

3 years ago

3.0.0-2

3 years ago

3.0.0-5

3 years ago

3.0.0-4

3 years ago

2.0.5-test5

3 years ago

2.0.5-test4

3 years ago

2.0.5-test7

3 years ago

2.0.5-test6

3 years ago

2.0.5-test9

3 years ago

2.0.5-test8

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.6

3 years ago

2.0.5-test10

3 years ago

2.0.5-test1

3 years ago

2.0.5-test3

3 years ago

2.0.5-test2

3 years ago

2.0.4-test5

3 years ago

2.0.4-test4

3 years ago

2.0.4-test3

3 years ago

2.0.4-test2

3 years ago

2.0.4-test1

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.0

3 years ago