npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vuetton

v0.1.2-c

Published

Vuetton is a simple library which lets you configure your button in the most feasible way. It supports click events, asynchronous operations, icons, loaders, custom classes etc.

Downloads

3

Readme

Vuetton Build Status

Vuetton is a simple library which lets you configure your button in the most feasible way. It supports click events, asynchronous operations, icons, loaders, custom classes etc.

https://www.npmjs.com/package/vuetton

Installation via npm

npm install --save vuetton

Options

Below are the options which can be used in order to customise the button as per your needs.

| Property | Type | Description | |---------|--------|-------------| |action | Function | This is a required property which accepts the reference of a function.| |align-icon | String | Icon's slot can be aligned by either left or right. Default is set to left| |async | Boolean | When async is true, the button will be disabled while still showing the loading icon until promise wrapped around the action is resolved. |color | String | This property determines the background-color of button.| |custom-class | String | This property assigns additional custom class to the button component.| |disabled | Boolean | If this property is true, then the particular button will be disabled.| |loader-text|String| This property accepts text which will be loaded during an asynchronous call.| |loader-image|String| This property accepts path of an image which will be loaded during an asynchronous call.| |ripple | | This property adds a ripple effect on clicking on the button.| |size|String| This property determines the size of a button; possible values taken are lg,md, sm and xs. If not provided, default size i.e medium is rendered.| |stop|Boolean| This property doesn't let the click event propogate to its parent. This works similar to how .stop modifier works in vue.| |text|String| This is a required property which defines a value.|
|type|String| This property determines the usage of button; possible values used are submit,button reset.|

Events

  • Use any event directly on the component and the same will be propogated to the actual button.
  • Special case in terms of :async=true - where action prop is mandatory which will be called on click event in order to show the loading animation and track the asynchronous call.

Attributes

  • Attributes can be passed normally to the component and all the attributes gets copied to actual button. This is particularly useful to add accessibility attributes, id, name etc.

Usage

  • Import the Vuetton component from node_modules.
import Vuetton from 'vuetton';
  • Use in your template
<Vuetton size="lg" type="button" text="lg" :async="true" :action="submitData"></Vuetton>

Size variations

lg - Large md - Medium (default) sm - Small xs - Extra small

Customization via CSS

Any custom class can be attached to the button through custom-class prop

<Vuetton size="lg" type="button" text="Submit" :action="submitData" custom-class="bg--red text--white"></Vuetton>

Asynchronous support

Component supports asynchronous methods during which button would remain disabled till the function completes its execution.

Keeping the prop async="true" will make sure button remains disabled during the function provided in onclick listener.

To add the text during async call, pass the prop loader-text.

To change the default loader image, pass the prop loader-image which must be an image path.

<Vuetton size="md" text="Submit" :async="true" :action="submitData" loader-text="Submitting..."></Vuetton>

Type

You can specify the type of button via type prop be it, button, reset, submit. type="button" will be the default behaviour if not provided.

Event Listeners

You can use all the button listener events on the Vuetton component and pass on the methods.

<Vuetton size="md" text="Submit" @mouseover="doSomething" @blur="removeSomething"></Vuetton>

Slot for icon

Default slot takes elements or anything which will be rendered on the button before the button's text.

<Vuetton size="md" text="Submit" @mouseover="doSomething" @blur="removeSomething" align-icon="right">
    <i class="material-icons">save</i>
</Vuetton>

Full Example

    <Vuetton 
      text="Submit Data" 
      type="submit"
      size="sm"
      custom-class="primary" 
      :action="callApi"
      :async="true"
      loader-text="Loading..."
      loader-image="https://example.com/loader.svg"
      @mouseover="toggleOn"
      @mouseout="toggleOff"
      ripple
      id="btnSubmit"
      aria-expanded="false"
    >
      <i class="material-icons">submit</i>
    </Vuetton>
  • Documentation link is coming soon