{"id":13397325,"url":"https://github.com/jonsuh/hamburgers","last_synced_at":"2025-06-10T18:33:20.091Z","repository":{"id":38395048,"uuid":"52645453","full_name":"jonsuh/hamburgers","owner":"jonsuh","description":"Tasty CSS-animated Hamburgers","archived":false,"fork":false,"pushed_at":"2023-05-24T01:21:02.000Z","size":1797,"stargazers_count":7096,"open_issues_count":35,"forks_count":1622,"subscribers_count":135,"default_branch":"master","last_synced_at":"2025-04-23T18:56:50.262Z","etag":null,"topics":["animation","css","hamburger","menu","sass"],"latest_commit_sha":null,"homepage":"https://jonsuh.com/hamburgers","language":"SCSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonsuh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-02-27T02:16:24.000Z","updated_at":"2025-04-23T16:35:49.000Z","dependencies_parsed_at":"2023-02-16T11:31:01.077Z","dependency_job_id":"d9d9ca5c-96b6-4327-99be-1e31a14712b8","html_url":"https://github.com/jonsuh/hamburgers","commit_stats":{"total_commits":214,"total_committers":12,"mean_commits":"17.833333333333332","dds":"0.16355140186915884","last_synced_commit":"b26b25f8c70d1412a73a0bf046c980710843dfca"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonsuh%2Fhamburgers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonsuh%2Fhamburgers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonsuh%2Fhamburgers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonsuh%2Fhamburgers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonsuh","download_url":"https://codeload.github.com/jonsuh/hamburgers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253969257,"owners_count":21992263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","css","hamburger","menu","sass"],"created_at":"2024-07-30T18:01:17.411Z","updated_at":"2025-05-13T15:11:07.639Z","avatar_url":"https://github.com/jonsuh.png","language":"SCSS","funding_links":[],"categories":["CSS","SCSS","📦 Legacy \u0026 Inactive Projects","Frameworks / Resources"],"sub_categories":["H"],"readme":"# Hamburgers\n\nHamburgers is a collection of tasty CSS-animated hamburger icons. Also included is the source as a [Sass](#sass) library. It’s modular and customizable, so cook up your own hamburger.\n\n![](http://i.imgur.com/t7cUjDu.gif)\n\n### Table of Contents\n\n- [Usage](#usage)\n- [Sass](#sass)\n- [Customization](#customization)\n- [Accessibility](#accessibility)\n- [Browser Support](#browser-support)\n\n## Usage\n\n1. [Download](https://github.com/jonsuh/hamburgers/blob/master/dist/hamburgers.css) and include the CSS in the `\u003chead\u003e` of your site:\n\n  ```html\n  \u003clink href=\"dist/hamburgers.css\" rel=\"stylesheet\"\u003e\n  ```\n\n2. Add the base hamburger markup:\n\n  ```html\n  \u003cbutton class=\"hamburger\" type=\"button\"\u003e\n    \u003cspan class=\"hamburger-box\"\u003e\n      \u003cspan class=\"hamburger-inner\"\u003e\u003c/span\u003e\n    \u003c/span\u003e\n  \u003c/button\u003e  \n  ```\n\n  You *can* use `\u003cdiv\u003e`s if you insist, but they’re not [accessible](#accessibility) as a menu button.\n\n  ```html\n  \u003cdiv class=\"hamburger\"\u003e\n    \u003cdiv class=\"hamburger-box\"\u003e\n      \u003cdiv class=\"hamburger-inner\"\u003e\u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n  ```\n\n3. Append the class name of the type of hamburger you’re craving:\n\n  ```html\n  \u003cbutton class=\"hamburger hamburger--collapse\" type=\"button\"\u003e\n    \u003cspan class=\"hamburger-box\"\u003e\n      \u003cspan class=\"hamburger-inner\"\u003e\u003c/span\u003e\n    \u003c/span\u003e\n  \u003c/button\u003e\n  ```\n\n  Here’s the list of hamburger-type classes you can choose from:\n\n  ```\n  hamburger--3dx\n  hamburger--3dx-r\n  hamburger--3dy\n  hamburger--3dy-r\n  hamburger--3dxy\n  hamburger--3dxy-r\n  hamburger--arrow\n  hamburger--arrow-r\n  hamburger--arrowalt\n  hamburger--arrowalt-r\n  hamburger--arrowturn\n  hamburger--arrowturn-r\n  hamburger--boring\n  hamburger--collapse\n  hamburger--collapse-r\n  hamburger--elastic\n  hamburger--elastic-r\n  hamburger--emphatic\n  hamburger--emphatic-r\n  hamburger--minus\n  hamburger--slider\n  hamburger--slider-r\n  hamburger--spin\n  hamburger--spin-r\n  hamburger--spring\n  hamburger--spring-r\n  hamburger--stand\n  hamburger--stand-r\n  hamburger--squeeze\n  hamburger--vortex\n  hamburger--vortex-r\n  ```\n\n  Note: `-r` classes are reverse variants (e.g. `hamburger--spin` spins clockwise whereas `hamburger--spin-r` spins counterclockwise.\n\n4. Trigger the active state by appending class name `is-active`:\n\n  ```html\n  \u003cbutton class=\"hamburger hamburger--collapse is-active\" type=\"button\"\u003e\n    \u003cspan class=\"hamburger-box\"\u003e\n      \u003cspan class=\"hamburger-inner\"\u003e\u003c/span\u003e\n    \u003c/span\u003e\n  \u003c/button\u003e\n  ```\n\n  Since the class name would have to be toggled via JavaScript and implementation would differ based on the context of how you plan on using the hamburger, I’m going to leave the rest up to you.\n\n## Sass\n\n`.scss` source files are available if you use Sass as your CSS precompiler. It’s customizable and modular.\n\n1. Hamburgers is available on [npm](https://www.npmjs.com/package/hamburgers), yarn and [Bower](http://bower.io/search/?q=css-hamburgers).\n\n  ```\n  npm install hamburgers\n\n  yarn add hamburgers\n\n  bower install css-hamburgers\n  ```\n\n  Also available as a [Ruby gem](https://rubygems.org/gems/hamburgers) to use within your Rails application—see [below](#install-for-ruby-on-rails) for more information.\n\n  Or to manually install it, [download](https://github.com/jonsuh/hamburgers/archive/master.zip) and unzip the source files, then copy the files from the `_sass/hamburgers` directory into your project.\n\n2. Import the `hamburgers.scss` file in your Sass manifest file:\n\n  ```scss\n  @import \"path/to/hamburgers\";\n  ```\n\n3. Customize your hamburger and/or remove any types you don’t want in `hamburgers.scss`.\n4. Compile your Sass*, and voila!\n\n\\* Be sure to run the CSS through [Autoprefixer](https://github.com/postcss/autoprefixer) since the Sass doesn’t account for vendor prefixes.\n\n### Install for Ruby on Rails\n\n1. Add Hamburgers to your Gemfile.\n\n  ```\n  gem 'hamburgers'\n  ```\n\n2. Run `bundle install`.\n3. Include Hamburgers by using Sass’s native `@import`**:\n\n  ```scss\n  // application.scss\n  @import \"hamburgers\";\n  ```\n\n  \\** [More information](https://blog.pivotal.io/pivotal-labs/labs/structure-your-sass-files-with-import) on why Sass’s native `@import` + why you should ditch Sprockets directives altogether.\n\n## Customization\n\nTo override default settings, declare them before importing Hamburgers:\n\n```scss\n$hamburger-padding-x: 20px;\n$hamburger-padding-y: 15px;\n$hamburger-types     : (collapse);\n\n@import \"hamburgers\";\n```\n\nYou can also create a separate file (e.g. `hamburgers-settings.scss`) with those declarations, then import it before Hamburgers:\n\n```scss\n@import \"hamburgers-settings\"\n@import \"hamburgers\";\n```\n\nHere is the full list of default settings (found in `_sass/hamburgers/hamburgers.scss`);\n\n```scss\n$hamburger-padding-x           : 15px;\n$hamburger-padding-y           : 15px;\n$hamburger-layer-width         : 40px;\n$hamburger-layer-height        : 4px;\n$hamburger-layer-spacing       : 6px;\n$hamburger-layer-color         : #000;\n$hamburger-layer-border-radius : 4px;\n$hamburger-hover-opacity       : 0.7;\n$hamburger-active-layer-color  : $hamburger-layer-color;\n$hamburger-active-hover-opacity: $hamburger-hover-opacity;\n\n// To use CSS filters as the hover effect instead of opacity,\n// set $hamburger-hover-use-filter as true and\n// change the value of $hamburger-hover-filter accordingly.\n$hamburger-hover-use-filter   : false;\n$hamburger-hover-filter       : opacity(50%);\n$hamburger-active-hover-filter: $hamburger-hover-filter;\n\n// Remove or comment out the hamburger types you don’t want\n// or need, so they get excluded from the compiled CSS.\n$hamburger-types: (\n  3dx,\n  3dx-r,\n  3dy,\n  3dy-r,\n  3dxy,\n  3dxy-r,\n  arrow,\n  arrow-r,\n  arrowalt,\n  arrowalt-r,\n  arrowturn,\n  arrowturn-r,\n  boring,\n  collapse,\n  collapse-r,\n  elastic,\n  elastic-r,\n  emphatic,\n  emphatic-r,\n  minus,\n  slider,\n  slider-r,\n  spring,\n  spring-r,\n  stand,\n  stand-r,\n  spin,\n  spin-r,\n  squeeze,\n  vortex,\n  vortex-r\n);\n```\n\n#### `ems` or `rems`\n\nWanna work with `ems` or `rems` instead of `px`? Just change all the `px` values to the unit of your choice. Note: Be consistent (all `px` or all `ems`), otherwise it may break—the math behind the customization will fail if it attempts to perform operations with values of different units.\n\n### Not satisfied?\n\nDig into `_base.scss` or `types/` and customize to your heart’s content. Fair warning: It‘s pretty delicate and may break, especially if you tweak the animations themselves.\n\n## Accessibility\n\nHamburger menu icons can be useful in the right context, but they’re not the most accessible.\n\nARIA will help make it accessible to people with disabilities.\n\n```html\n\u003cnav\u003e\n  \u003cbutton class=\"hamburger hamburger--elastic\" type=\"button\"\n          aria-label=\"Menu\" aria-controls=\"navigation\" aria-expanded=\"true/false\"\u003e\n    \u003cspan class=\"hamburger-box\"\u003e\n      \u003cspan class=\"hamburger-inner\"\u003e\u003c/span\u003e\n    \u003c/span\u003e\n  \u003c/button\u003e\n\n  \u003cdiv id=\"navigation\"\u003e\n    \u003c!--navigation goes here--\u003e\n  \u003c/div\u003e\n\u003c/nav\u003e\n```\n\nYou will need JavaScript to toggle between `aria-expanded` attribute being set to `true` and `false`, as this will indicate to visually impaired users whether the menu is opened or closed.\n\nThe hamburger button belongs __inside__ the `\u003cnav\u003e` so that assistive technologies will be able to locate the navigation, and to allow these users to easily locatate the hamburger button, without having to search up and down the DOM, once they realize they've found themselves in an empty navigation.\n\nIf you insist on using `\u003cdiv\u003e`s, by default they’re not focusable (i.e. via keyboard or assistive technology). Add the `tabindex` attribute alongside ARIA. You will also need to recreate expected keyboard functionality for these `\u003cdiv\u003e`s. Using JavaScript, you will need to make sure that both \u003ckbd\u003eSpace\u003c/kbd\u003e and \u003ckbd\u003eEnter\u003c/kbd\u003e will toggle the hamburger states.\n\n```html\n\u003cnav id=\"navigation\"\u003e\n\n  \u003cdiv class=\"hamburger hamburger--elastic\" tabindex=\"0\"\n       aria-label=\"Menu\" role=\"button\" aria-controls=\"navigation\" aria-expanded=\"true/false\"\u003e\n    \u003cdiv class=\"hamburger-box\"\u003e\n      \u003cdiv class=\"hamburger-inner\"\u003e\u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n\n  \u003cdiv id=\"navigation\"\u003e\n    \u003c!--navigation goes here--\u003e\n  \u003c/div\u003e\n\u003c/nav\u003e\n```\n\nA label will help make it more obvious that it toggles a menu.\n\n```html\n\u003cbutton class=\"hamburger hamburger--collapse\" type=\"button\"\u003e\n  \u003cspan class=\"hamburger-box\"\u003e\n    \u003cspan class=\"hamburger-inner\"\u003e\u003c/span\u003e\n  \u003c/span\u003e\n  \u003cspan class=\"hamburger-label\"\u003eMenu\u003c/span\u003e\n\u003c/button\u003e\n```\n\nHere are [some](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) [resources](https://webaccessibility.withgoogle.com/course) on [web](http://a11yproject.com/) [accessibility](http://www.html5accessibility.com/) and [ARIA](https://w3c.github.io/aria-in-html/).\n\n## Browser Support\n\nAnimations use CSS3 3D transforms (`translate3d` whenever possible for GPU acceleration), which is supported by most browsers (not supported by IE9 and older and Opera Mini). For detailed browser support, check [caniuse.com](http://caniuse.com/#search=translate3d).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonsuh%2Fhamburgers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonsuh%2Fhamburgers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonsuh%2Fhamburgers/lists"}