Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/madeleineostoja/svelte-hamburger

Animated hamburger icon for svelte
https://github.com/madeleineostoja/svelte-hamburger

animated-icons hamburger-icon hamburger-menu svelte

Last synced: 28 days ago
JSON representation

Animated hamburger icon for svelte

Awesome Lists containing this project

README

        


Svelte Hamburger

[![NPM](https://img.shields.io/npm/v/svelte-hamburger)](https://www.npmjs.com/package/svelte-hamburger) [![License](https://img.shields.io/npm/l/svelte-hamburger)](https://github.com/madeleineostoja/svelte-hamburger/blob/master/LICENSE.md)

Featherweight, performant, animated hamburger menu icon for Svelte with no external dependencies.

### Usage

```sh
npm i svelte-hamburger
```

```svelte

import Hamburger from 'svelte-hamburger';

let open = false;

open = !open} />
```

### Properties

| Property | Type | Default | Description |
| --------- | --------- | ------- | ---------------------------------------- |
| `open` | `boolean` | `false` | Whether hamburger is open |
| `duoLine` | `boolean` | `false` | Whether to only use 2 lines for the icon |

```svelte

```

### Styling

Set the desired height, width, and color of the icon direclty on the component. It will consume `class` strings and you can target them with a `:global` modifier in your Svelte styles.

```svelte

header :global(.hamburger) {
/* Custom styles */
}

```

Additionally the following CSS properties are available for more fine grained control over the style of the icon.

| Property | Default | Description |
| -------------- | ------- | ----------------------- |
| `--line-width` | `2px` | Width of the icon lines |

```svelte

```