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

@mcwv/button

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcwv/button

The Vue Material Adapter for the web button component

  • 0.1.0-5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Usage

<mdc-button @click="onClick" :disabled="buttonDisabled">click me</mdc-button>
var vm = new Vue({
  data:{
    buttonDisabled: false
  },
  methods: {
    onClick () {...}
  }
})

events

eventargsDescription
@clickemitted on click

props

propTypeDefaultDescription
disabledStringdisable the button
raisedBooleana contained button that is elevated upon the surface
unelevatedBooleana contained button that is flush with the surface
outlinedBooleana contained button that is flush with the surface and has a visible border(*)
denseStringcompresses the button text to make it slightly smaller
eventStringoptionaloptional event to emit on click
event-targetObjectvm.$rootoptional event target, defaults to root bus
event-argsArray[]optional event args
hrefStringlink's href, renders anchor (see notes below)
toString, Objectundefinedrouter-link property (*)
replaceBooleanfalserouter-link property (*)
appendBooleanfalserouter-link property (*)
exactBooleanfalserouter-link property (*)
active-classStringrouter-link-activerouter-link property (*)
exact-active-classStringrouter-link-exact-activerouter-link property (*)

(*) Requires vue-router

text buttons

<mdc-button>Baseline</mdc-button>
<mdc-button dense>Dense</mdc-button>

Raised Button

<mdc-button raised>Baseline</mdc-button>
<mdc-button raised dense>Dense</mdc-button>

Unelevated buttons

<mdc-button unelevated>Baseline</mdc-button>
<mdc-button unelevated dense>Dense</mdc-button>

Icon buttons

<mdc-button ><i class="material-icons mdc-button__icon">favorite</i>like</mdc-button>

or an SVG button

<mdc-button >  <svg class="mdc-button__icon" xmlns="http://www.w3.org/2000/svg" viewBox="...">
  ...
  </svg>
  like
</mdc-button>

Note: mdc-icon is not suitable for rendering in an mdc-button as it does not set the required mdc-button__icon class.

Using the href attribute will render <a role="button" href="...">

<mdc-button href="#">Home</mdc-button>

If the to property is defined, the item behaves as a router-link

<mdc-button to="/home">Home</mdc-button>
Accessibility Warning:

Buttons are expected to be triggered using the Space or Enter key, while links are expected to be triggered using the Enter key. Additionally, button and links have different behaviors on right click. see this MDN note

You might want to keep button behaviour and do the navigation programatically:

<mdc-button @click="location.href='#'">Home</mdc-button>
<mdc-button @click="$router.push(...)">Home</mdc-button>

Triggering events

 <mdc-button event='my-event'>Do Something</mdc-button>
// register event from some component context
this.$root.$on('my-event', () => doSomething())

Reference

Keywords

FAQs

Package last updated on 08 Mar 2019

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