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

lkt-iconic-box

v1.0.4

Published

A simple button component for Vue.js 3.0.

Downloads

1

Readme

LKT Button

A simple button component for Vue.js 3.0.

Installation

With npm

npm i -S lkt-button

Typical use:

In your main.js

  import LktButton from 'lkt-button';
  
  app.use(LktButton);

App use options:

  • defaultState string (default: undefined) => Set a default state for all buttons

In your component:

<lkt-button v-on:click="doSomething" v-bind:disabled="disabledChecker"></lkt-button>
export default {
    methods: {
      doSomething() {
          console.log('May the force be with you');
      },
      disabledChecker() {
          return false;
      },
      
    }
}

Props

type

Type: String Required: false Default: button Options: button, submit, reset

Determines which kind of button will be.

<lkt-button type="submit"></lkt-button>

name

Type: String Required: false Default: a random string is generated

An identifier emitted on click.

<lkt-button name="sendMessage"></lkt-button>

value

Type: String Required: false Default: '

Set a value for form buttons. Emitted on click.

<lkt-button v-bind:value="myButton"></lkt-button>

palette

Type: String Required: false Default: ''

Appends a palette classname. It's useful for palette control and styling.

<lkt-button palette="calculating"></lkt-button>

disabled

Type: Boolean Required: false Default: false

Determines if button is disabled or not.

<lkt-button disabled></lkt-button>
<lkt-button v-bind:disabled="disabledChecker"></lkt-button>

Events

  • LktButton emits these events:

    • click

HTML:

<lkt-button v-on:click="doSomething"></lkt-button>

Slots

default slot

This slot allows you to fill the button with whatever you want.

<lkt-button name="testButton" v-on:click="doSomething">
  Click, me!
</lkt-button>

prev/next slot

These slots are designed to add something before/after the text, like an icon.

<lkt-button name="testButton" v-on:click="doSomething">
  Click, me!
  <template v-slot:prev>
    <i class="font-icon"></i>
  </template>
  <template v-slot:next>
    <i class="font-icon2"></i>
  </template>
</lkt-button>

prev-loading/next-loading slot

Same as prev/next but only appears if button is loading

<lkt-button name="testButton" v-on:click="doSomething">
  Click, me!
  <template v-slot:prev-loading>
    <i class="font-icon"></i>
  </template>
  <template v-slot:next-loading>
    <i class="font-icon2"></i>
  </template>
</lkt-button>

Styling

Style configuration

If you want to modify the default style without having to override styles in CSS, you can use the configurator like this:

@use "node_modules/lkt-button/lkt-button";

@include lkt-button.configure((border-width: 2px)); //opts list

Available style options

| Option | Default value | |---------------|---------------------------------------| | border-width | 1px | | border-style | solid | | border-color | #ddd | | color | #333 | | background | transparent | | height | 35px | | min-width | 150px | | padding | 7px | | slot-gap | 5px | | font-weight | 300 | | line-height | 1 | | text-align | center | | cursor | default | | box-shadow | none | | border-radius | lkt-theme.$primary-border-radius | | transition | lkt-theme.$primary-transition | | font-size | lkt-theme.$primary-button-font-size | | font-family | lkt-theme.$primary-button-font-family |

Style generation

The following example will show you how to generate styles.

@use "node_modules/lkt-button/lkt-button";

@include lkt-button.generate();

Theme modifiers

If lkt-theme is configured, the generate mixin also will generate some colored styles if colors were configured in lkt-theme.

These modifiers will be the way:

lkt-button-- lkt-button---dark lkt-button---darker lkt-button---light lkt-button---lighter

For example, if you already set up info color and info color dark, it will generate the following modifiers:

lkt-button--info lkt-button--info-dark

All lkt-theme colors can generate a modifier but disabled (which generates styles if button is disabled) and focus (which is not intended for this component).

Some example could be:

lkt-button--info lkt-button--info-dark lkt-button--info-darker lkt-button--info-light lkt-button--info-lighter

lkt-button--success lkt-button--success-dark lkt-button--success-darker lkt-button--success-light lkt-button--success-lighter

lkt-button--warning lkt-button--warning-dark lkt-button--warning-darker lkt-button--warning-light lkt-button--warning-lighter

Using CSS Selectors in HTML

<lkt-button class="lkt-button--info">More info</lkt-button>

<lkt-button class="lkt-button--success-light">Confirm action</lkt-button>

The palette prop

You can apply lkt-theme modifiers with the palette prop this way:

<lkt-button palette="info">More info</lkt-button>

<!-- Is the same as: -->

<lkt-button class="lkt-button--info">More info</lkt-button>