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

ease-button-ui

v2.0.1

Published

A simple yet customizable button UI for your Vue.js projects. With Ease!

Downloads

29

Readme

Ease Button UI

A simple yet customizable button UI for your Vue.js projects. With Ease!

Installation

You can install ease-button-ui via npm by running the following command:

npm install ease-button-ui --save-dev
  • this package require you to install pinia, so make sure you already have it. Or install it by running the following command:
npm install pinia

Usage

<script>
import { EaseButton } from "ease-button-ui";
</script>

<template>
    <!-- Basic Usage -->
    <EaseButton text="Hello World!" />

    <!-- With slotted content -->
    <EaseButton slotted>
        Hello World!
    </EaseButton>

    <!-- Loading with text -->
    <EaseButton
      v-bind="{
        text: 'Wait for me!',
        loading: true,
        onLoading: () => ({
          text: 'Loading...',
          icon: EaseLoading, // loading component
        }),
      }"
    />

    <!-- loading without text -->
    <EaseButton
      v-bind="{
        text: 'Loading with text!',
        loading: true,
        onLoading: () => ({
          text: false,
          icon: EaseLoading, // loading component
        }),
      }"
    />
</template>

Custom Style

You can modify ease button default style to your favorite style!. Take a look at this:

import { useEaseButton} from "ease-button-ui";

const easeButton = useEaseButton();

easeButton.defaultStyle({
    color: '#fff', // accept css variables, hex, and rgb
    bgColor: '#1d4ed8', // accept css variables, hex, and rgb
    border: "2px solid #1d4ed8",
    borderRadius: "0.2rem",
    outlineStyle: 'solid',
    outlineColor: "#1d4ed8",
    outlineColorOpacity: 0.5,
    classes: 'transition ease-in-out', // define your classes as default style
});

Custom Variant

You also want to add variants other than primary, secondary, and link:

easeButton.addVariant({
    success: {
        color: '#fff',
        bgColor: '#16a34a',
        // the rest are the same as defaultStyle({})
    },
    danger: {
        color: '#fff',
        bgColor: '#dc2626',
        // the rest are the same as defaultStyle({})
    },
});

Available properties

The Available properties are:

interface EaseButtonProps {
    type?: 'button' | 'submit' | 'reset', // defaults `button`
    text?: string;
    size?: 'sm' | 'base' | 'lg' | 'xl'; // defaults `base`
    variant?: 'primary' | 'secondary' | 'link'; // defaults `primary`
    rounded?: 'none' | 'base' | 'full'; // defaults `base`
    slotted?: boolean; // defaults `false`
    loading?: boolean; // defaults `false`
    onLoading?: () => ({
        text?: string; // defaults your button `text`
        icon?: VueComponent | boolean; // defaults `EaseIcon` 
        disabled?: boolean; // defaults `true`
    });
}

interface IButtonStyle {
    color?: string | null;
    bgColor?: string | null;
    border?: string | null;
    borderRadius?: string | null;
    outlineStyle?: string | null;
    outlineColor?: string | null;
    outlineColorOpacity?: number | null;
    textDecoration?: string | null;
    classes?: string | null;
}

interface IButtonVariant {
    [key: string]: IButtonStyle;
}