All Projects → offirgolan → Ember Burger Menu

offirgolan / Ember Burger Menu

Licence: mit
An off-canvas sidebar component with a collection of animations and styles using CSS transitions

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Ember Burger Menu

ember-right-click-menu
An easy and flexible addon to add context menus anywhere in your application
Stars: ✭ 14 (-95%)
Mutual labels:  ember, ember-addon, menu
ember-headlessui
gavinjoyce.github.io/ember-headlessui/
Stars: ✭ 76 (-72.86%)
Mutual labels:  ember, ember-addon
glimmer-apollo
Ember and Glimmer integration for Apollo Client.
Stars: ✭ 32 (-88.57%)
Mutual labels:  ember, ember-addon
ember-stripe-elements
A simple Ember wrapper for Stripe Elements.
Stars: ✭ 64 (-77.14%)
Mutual labels:  ember, ember-addon
ember-luxon
🕐 🌐 [deprecated] Addon thats brings Luxon to Ember applications.
Stars: ✭ 20 (-92.86%)
Mutual labels:  ember, ember-addon
ember-changeset-conditional-validations
Conditional validations for ember-changeset-validations
Stars: ✭ 26 (-90.71%)
Mutual labels:  ember, ember-addon
ember-rapid-forms
Smart, Intuitive forms for Ember.js styled with Bootstrap, Multi layouts and Validation support.
Stars: ✭ 58 (-79.29%)
Mutual labels:  ember, ember-addon
ember-deep-set
Deeply set values on an Ember Object or POJO
Stars: ✭ 30 (-89.29%)
Mutual labels:  ember, ember-addon
ember-deep-tracked
Deep auto-tracking for when you just don't care, and want things to work (at the cost of performance in some situtations)
Stars: ✭ 20 (-92.86%)
Mutual labels:  ember, ember-addon
ember-key-manager
A service for (un)binding keyboard up and down events.
Stars: ✭ 39 (-86.07%)
Mutual labels:  ember, ember-addon
ember-gridstack
Ember components to build drag-and-drop multi-column grids powered by gridstack.js
Stars: ✭ 31 (-88.93%)
Mutual labels:  ember, ember-addon
els-addon-typed-templates
Ember templates linting / autocomplete, based on Typescript language server
Stars: ✭ 27 (-90.36%)
Mutual labels:  ember, ember-addon
ember-cli-daterangepicker
Just a simple component to use bootstrap-daterangepicker.
Stars: ✭ 32 (-88.57%)
Mutual labels:  ember, ember-addon
ember-simple-auth-token
Ember Simple Auth extension that is compatible with token-based authentication like JWT.
Stars: ✭ 356 (+27.14%)
Mutual labels:  ember, ember-addon
ember-fsm
[Maintenance Mode] A promise-aware finite state machine implementation for Ember
Stars: ✭ 37 (-86.79%)
Mutual labels:  ember, ember-addon
ember-credit-card
"make your credit card form dreamy in one line of code"
Stars: ✭ 89 (-68.21%)
Mutual labels:  ember, ember-addon
ember-render-helpers
Complimentary render template helpers to the render modifiers
Stars: ✭ 19 (-93.21%)
Mutual labels:  ember, ember-addon
ember-bootstrap-power-select
Integrate ember-power-select into your ember-bootstrap forms
Stars: ✭ 37 (-86.79%)
Mutual labels:  ember, ember-addon
ember-do-forms
ember-do-forms handles the icky parts of forms that you don't want to, and leaves the rest to you.
Stars: ✭ 18 (-93.57%)
Mutual labels:  ember, ember-addon
ember-new-relic
Adds New Relic to your Ember CLI app based on the app's environment
Stars: ✭ 29 (-89.64%)
Mutual labels:  ember, ember-addon

Ember Burger Menu

Ember Version Build Status npm version

An off-canvas sidebar component with a collection of animations and styles using CSS transitions

Features

  • Easy to use & setup off-canvas menu
  • Mix and match from many menu & menu item animations
  • Swipe gesture support with changeable thresholds
  • Easily create your own animations

Installation

ember install ember-burger-menu

Sass

Installing ember-burger-menu should also install ember-cli-sass and automatically create a scss file under app/styles/app.scss with

// app/styles/app.scss

@import 'ember-burger-menu';

Overriding Variables

Using sass, you can override default variables and easily change the default behavior of ember-burger-menu. See variables.scss for a list of variables you can change.

// app/styles/app.scss

// Burger Menu Overrides
$bm-transition-duration: 0.3s;
$bm-overlay-background: rgba(0, 0, 0, 0.7);

// Import all the styles!
@import 'ember-burger-menu';

Import Only What You Need

Using sass, you can import only the styles you need for the animations you use.

// Core Styles
@import 'ember-burger-menu/variables';
@import 'ember-burger-menu/structure';

// Animations
@import 'ember-burger-menu/animations/push';
@import 'ember-burger-menu/animations/menu-item/stack';

Helpful Links

Looking for help?

If it is a bug please open an issue on GitHub.

Animations

Menu Animations

  • slide
  • reveal
  • push
  • fall-down
  • open-door
  • push-rotate
  • rotate-out
  • scale-up
  • scale-down
  • scale-rotate
  • slide-reverse
  • squeeze

Menu Item Animations

  • push
  • stack

Usage

This addon utilizes contextual components to be able to correctly control and animate necessary elements.

{{#burger-menu as |burger|}}
  {{#burger.menu itemTagName="li" as |menu|}}
    <button {{action burger.state.actions.close}}>Close</button>

    <ul>
      {{#menu.item}}
        {{link-to 'Features' 'features'}}
      {{/menu.item}}

      {{#menu.item}}
        {{link-to 'About' 'about'}}
      {{/menu.item}}

      {{#menu.item}}
        {{link-to 'Contact Us' 'contact'}}
      {{/menu.item}}
    </ul>
  {{/burger.menu}}

  {{#burger.outlet}}
    <button {{action burger.state.actions.toggle}}>Menu</button>
    {{outlet}}
  {{/burger.outlet}}
{{/burger-menu}}

Components

{{burger-menu}}

Options

  • open

    The current open state of the menu.

    Default: false

  • animation

    The menu animation. See Animations for the list of available animations.

    Default: slide

  • itemAnimation

    The menu item animation. See Item Animations for the list of available item animations.

    Default: null

  • position

    The menu's open position. Can either be left or right

    Default: left

  • width

    The menu's width (in px).

    Default: 300

  • locked

    Lock the menu in its current open / closed state.

    Default: false

  • customAnimation

    Override of the menu's styles with your own implementation. See Custom Animations for more details.

  • translucentOverlay

    Whether the outlet has a translucent overlay over it once the menu is opened.

    Default: true

  • dismissOnClick

    Whether the menu can be dismissed when clicking outside of it.

    Default: true

  • dismissOnEsc

    Whether the menu can be closed when pressing the ESC key.

    Default: true

  • gesturesEnabled

    Whether the menu can be open / closed using gestures. The only available gesture currently is swipe.

    Default: true

  • minSwipeDistance

    The minimum distance (in px) the user must swipe to register as valid.

    Default: 150

  • maxSwipeTime

    The maximum amount of time (in ms) it must take the user to swipe to be registered as valid .

    Default: 300

{{burger.outlet}}

This component is where all your content should be placed.

{{burger.menu}}

Everything rendered here will be inside the menu.

Options

  • itemTagName

    The default tagName that will be used by the {{menu.item}} component.

    Default: div

  • dismissOnItemClick

    Close the menu on click of a {{menu.item}}.

    Default: false

Actions

  • onOpen

    Triggered when the menu is opening

  • onClose

    Triggered when the menu is closing

{{menu.item}}

The individual menu item. This is required if you have specified an itemAnimation.

Options

  • dismissOnClick

    Close the menu on click.

    Default: false

The Menu State

The {{burger-menu}} component exposes multiple contextual components, but it also exposes a state object.

You can use the menu state object to modify pretty much any property.

  • open
  • width
  • position
  • animation
  • itemAnimation
  • customAnimation

The state object also exposes some actions:

  • open

    <button {{action burger.state.actions.open}}>Open</button>
    
  • close

    <button {{action burger.state.actions.close}}>Close</button>
    
  • toggle

    <button {{action burger.state.actions.toggle}}>Toggle</button>
    

Custom Animations

If you're not impressed with the in-house animations and want to create your own, all you have to do is pass the following class to the customAnimation property in the {{burger-menu}} component. If you think your animation would be a good addition to the existing collection, feel free to open a PR with it!

import Animation from 'ember-burger-menu/animations/base';

export default Animation.extend({
  // CSS class names to be able to target our menu
  animation: 'my-custom-animation',
  itemAnimation: 'my-custom-item-animation',

  container(open, width, right) {
    return {};
  },

  outlet(open, width, right) {
    return {
      transform: open ? right ? `translate3d(-${width}px, 0, 0)` : `translate3d(${width}px, 0, 0)` : ''
    };
  },

  menu(open, width, right) {
    return {};
  },

  menuItem(open, width, right, index) {
    return {
      transform: open ? '' : `translate3d(0, ${(index + 1) * 500}px, 0)`
    };
  }
});

Note: You don't need to worry about prefixing your CSS attributes as it will be done for you.

If you need to add some base CSS to your animation, you can target the menu as such:

.ember-burger-menu.bm--my-custom-animation {
  #{$bm-menu} {}
  > .bm-outlet {}

  &.is-open {
    #{$bm-menu} {}
    > .bm-outlet {}
  }
}

And the menu items as such:

.ember-burger-menu.bm-item--my-custom-item-animation {
  #{$bm-menu} {
    .bm-menu-item {}
  }

  &.is-open {
    #{$bm-menu} {
      .bm-menu-item {}
    }
  }
}

To use our new custom animation, all we have to do is pass the class to the customAnimation option in the {{burger-menu}} component.

import MyCustomAnimation from 'path/to/my-custom-animation';

export default Ember.Component.extend({
  MyCustomAnimation
});
{{#burger-menu customAnimation=MyCustomAnimation}}
  ...
{{/burger-menu}}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].