2.3.2 • Published 12 months ago

todovue-button v2.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

TODOvue Button

TvButton is a custom button component for web applications.

npm Netlify Status Pipeline npm npm GitHub GitHub Release Date

Table of Contents

Installation

Install with npm or yarn

npm install todovue-button
yarn add todovue-button

Import

import { TvButton } from 'todovue-button'

You can also import it directly in the main.js file, so you don't have to import it in the pages

import { createApp } from "vue";
import App from "./App.vue";
import TvButton from "todovue-button";

const app = createApp(App);
app.component("TvButton", TvButton);
app.mount("#app");

Usage

<template>
  <tv-button @click-button="clickHandler">
    Default
  </tv-button>
</template>

<script>
  import TvButton from "todovue-button"; // Only if you have not imported it from main
  export default {
    components: {
      TvButton // Only if you have not imported it from main
    },
    setup() {
      const clickHandler = () => {
        console.log("clicked");
      }

      return {
        clickHandler
      }
    }
  }
</script>

Props

NameTypeDefaultDescription
typeStringbuttonThe type of button
customStyleObject{}object that defines the custom style of the button. You can include backgroundColor and color.
isOutlinedBooleanfalseIf true, the button will be outlined.
isSmallBooleanfalseIf true, the button will be small.
isLargeBooleanfalseIf true, the button will be large.
isSuccessBooleanfalseIf true, the button will be success.
iconStringnullThe icon of the button.
isInfoBooleanfalseIf true, the button will be info.
isWarningBooleanfalseIf true, the button will be warning.
isErrorBooleanfalseIf true, the button will be error.
isDisabledBooleanfalseIf true, the button will be disabled.
isTextBooleanfalseIf true, the button will be text.
iconPositionStringleftThe position of the icon. You can use left and right.
buttonTextStringnullThe text of the button.

Icons

You can use the following icons (icon="account"):

  • account
  • alert
  • arrow-down
  • arrow-left
  • arrow-right
  • arrow-up
  • cancel
  • cancel-light
  • edit
  • dark
  • favorite
  • help
  • light
  • menu
  • menu-light
  • minus
  • plus
  • remove
  • search
  • search-light
  • settings
  • share
  • star

Events

NameDescription
click-buttonEmitted when the button is clicked. You can use it to call a function, etc.

Customize

You can customize the button style by passing an object to the customStyle prop. You can include backgroundColor and color.

<template>
  <tv-button :customStyle="customStyle" @click-button="clickHandler">
    Default
  </tv-button>
</template>

<script>
  import { ref } from "vue";
  export default {
    setup() {
      const customStyle = ref({
        backgroundColor: "#000",
        color: "#fff"
      })
      
      const clickHandler = () => {
        console.log("clicked");
      }

      return {
        customStyle,
        clickHandler
      }
    }
  }
</script>

Development

Clone the repository and install the dependencies

git clone https://github.com/TODOvue/todovue-button.git
cd todovue-button

Install the dependencies

yarn install

Run the project

yarn demo

Run the tests

yarn test:unit

Run the linter

yarn lint

Run the build It is not necessary to generate build, since it is generated when you do PR to the master branch

yarn build

License

MIT

2.3.2

12 months ago

2.3.1

12 months ago

2.3.0

12 months ago

2.2.0

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago