Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/boguz/burgton-button

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/boguz/burgton-button

  • v0.0.0-20220127085658-774b140c6ac4
  • Source
  • Go
  • Socket score

Version published
Created
Source

burgton-button

<burgton-button> is a simple, customisable and accessible lit-element menu burger button that you can use in your projects.

Amongst other features, it allows you to choose from different animations, customise colors, animation speed and event toggle classes on multiple targets on the page.

DEMO

You can find examples of the different button possibilities on the documentation page

DOCUMENTATION

On the documentation page you can find an easy to follow "Getting Started" guide, as well as a API description so you can fully customize your <burgton-button> element.

GETTING STARTED

You can use the element on your project in 3 simple steps:

  1. Install the <burgton-button> on your project via NPM (or download it here)

    npm install burgton-button
    
  2. Import the <burgton-button> module on your project

    <script type="module" src="node_modules/burgton-button/index.js"></script>
    
  3. Add the element to your page and customize it to your taste

    <burgton-button type="astronaut"></burgton-button>
    

API

Attributes

You can use some attributes to customize your <burgton-button> button

AttributeDescriptionValid ValuesDefaultExample
typeDefines the button animation'default', 'arrow-left', 'arrow-right', 'arrow-to-arrow', 'astronaut', 'async', 'crossed', 'ellipsis', 'fall-down', 'minus', 'rotator', 'spin', 'underlined', 'vertical-rotator', 'zoom''default'<burgton-button type="astronaut"></burgton-button>
labelDefines the text that will be show with the buttonString-<burgton-button label="Menu"></burgton-button>
labelPositionDefines the position of the label text in relation to the button'top', 'bottom', 'right', 'left'-<burgton-button label="Menu" labelPosition="top"></burgton-button>
targetSelectorsDefines on which elements you want to toggle a class when the button is clicked. You can select multiple elements by separating the selectors with a commaCSS Selector-<burgton-button targetSelectors="#circle-one, .circle-two" targetClasses="active, colorful"></burgton-button>
targetClassesDefines the class that will be toggled on the selected element. The number of classes must match the number of selectorsCSS selector-<burgton-button targetSelectors="#circle-three" targetClasses="active"></burgton-button>
descriptionDefines the default text for the 'aria-label' attribute. This value is overwritten with the label text (if present)String'Menu button'<burgton-button description="Menu on/off button"></burgton-button>
noAnimationDisables the button animation, making the transition between inactive and active states immediate--<burgton-button noAnimation></burgton-button>
Styles

<burgton-button> exposes several CSS custom properties that you can use to further customize it.

PropertyDescriptionValid ValuesDefaultExample
--burgton-button-line-colorSet the color of the button linesCSS color value#66cc99--burgton-button-line-color: tomato;
--burgton-button-line-color-activeSet the color of the button lines when it is active. If not defined will inherit color from inactive state.CSS color value--burgton-button-line-color--burgton-button-line-color-active: purple;
--burgton-button-animation-durationSet the animation durationCSS time value500ms--burgton-button-animation-duration: .75s;
--burgton-button-easingSet the animation easingCSS easing valueease-in-out--burgton-button-easing: ease-out;
--burgton-button-scaleSet the button scale (size)Number (multiplier)1--burgton-button-scale: 1.3;
--burgton-button-border-radiusSet the button lines border-radiusCSS border-radius value0px--burgton-button-border-radius: 2px;
--burgton-button-label-font-sizeSet the font-size for the button labelCSS font-size value14px--burgton-button-label-font-size: 1rem;
--burgton-button-label-font-colorSet the font color for the button labelCSS color value#999999--burgton-button-label-font-color: white;
--burgton-button-label-font-color-activeSet the font color for the label text when the button is activeCSS color value#999999--burgton-button-label-font-color-active: purple;
--burgton-button-label-font-weightSet the font weight for the label text when the button is activeCSS font-weight valueinherit--burgton-button-label-font-weight: 600;
--burgton-button-label-text-transformSet the text-transform for the label text when the button is activeCSS text-transform valueuppercase--burgton-button-label-text-transform: capitalize;
Methods

<burgton-button> exposes several methods which you can call from your application.

MethodDescriptionExample
.toggleState()Toggle between the button's active and inactive stateyourButton.toggleState();
.activate()Activate the buttonyourButton.activate();
.deactivate()Deactivate the buttonyourButton.deactivate();
Events

` fires several custom events so you can react to them on your application.

EventDescription
burgton-button-state-changeFires whenever the button's state changes
burgton-button-clickFires whenever the button is clicked
burgton-button-activateFires whenever the button state becomes active
burgton-button-deactivateFires whenever the button state becomes inactive
A11y

Accessibility is very important, so we try to implement some good practices to reach as many users as possible and provide them a good experience. We do this mainly by adding several relevant aria attributes and also by giving you the possibility to change them via attributes.

CONTRIBUTING

If you have any ideas, suggestions or question you can open an issue on this github repo.

You can also find the burgton-button package on NPM.

FAQs

Package last updated on 27 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc