GithubHelp home page GithubHelp logo

hsarhan / svelte-hamburgers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ghostdevv/svelte-hamburgers

0.0 0.0 0.0 277 KB

Custom Hamburger Icons in Svelte with ease

Home Page: svelte-hamburgers.vercel.app

License: Other

JavaScript 1.10% TypeScript 0.59% HTML 0.83% SCSS 92.01% Svelte 5.47%

svelte-hamburgers's Introduction

๐Ÿ” Svelte Hamburgers

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

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" />

Property Type Default Description
type string spin The type of burger you want, you can see the types here, it should be lowercase.
--color string black The color of the burger.
--active-color string value of --color The color of the burger when active.
--padding string 15px The padding.
--layer-width string 30px The width of the burger.
--layer-height string 2px The height of the burger.
--layer-spacing string 6px The spacing between layers of the burger.
--border-radius string 4px The border radius of each burger part.
--hover-opacity number 0.7 The opacity amount on hover.
--hover-opacity-active number value of --hover-opacity The opacity amount of hover when active.

Support

svelte-hamburgers's People

Contributors

braebo avatar dependabot[bot] avatar ghostdevv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.