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

outbound-button

v2.0.0-alpha.7-9

Published

Angular 2 Material button

Downloads

7

Readme

md-button

md-button is an HTML <button> or <a> tag enhanced with styling and animation to match the Material Design button spec.

Users should employ a button element (<button>) when clicking triggers some action in the current view without navigating. An anchor element (<a>) should be used when clicking navigates the user to another URL. Depending on which element is used, the component will either be an instance of MdButton or MdAnchor. Visually, the two are identical.

Button types

There are five types of buttons:

  1. Flat buttons - md-button
    • Rectangular button
    • Defaults to white background
    • No box shadow
  2. Raised buttons - md-raised-button
    • Rectangular button
    • Defaults to white background
    • Box shadow applied
  3. Icon buttons - md-icon-button
    • Circular button
    • Transparent background
    • 40 by 40 px
  4. Floating Action Buttons (FABs) - md-fab
    • Circular button
    • Defaults background to "accent" palette defined in theme
    • Box shadow applied
    • 56 by 56 px
  5. Mini Floating Action Buttons (Mini FABs) - md-mini-fab
    • Circular button
    • Defaults background to "accent" palette defined in theme
    • Box shadow applied
    • 40 by 40 px

Each is an attribute directive that you can add to a button or a tag. You can provide custom content to the button by inserting it between the tags, as you would with a normal button.

Example:

<button md-button>FLAT</button>
<button md-raised-button>RAISED</button>
<button md-icon-button>
   <md-icon class="md-24">favorite</md-icon>
</button>
<button md-fab>
   <md-icon class="md-24">add</md-icon>
</button>
<button md-mini-fab>
   <md-icon class="md-24">add</md-icon>
</button>

Output:

Theming

All button types can be themed to match your "primary" palette, your "accent" palette, or your "warn" palette using the color attribute. Simply pass in the palette name.

In flat buttons, the palette chosen will affect the text color, while in other buttons, it affects the background.

Example:

<button md-raised-button color="primary">PRIMARY</button>
<button md-raised-button color="accent">ACCENT</button>
<button md-raised-button color="warn">WARN</button>

Output:

Disabling

You can disable any button type through the native disabled property. You can add it directly, or bind it to a property on your component class by adding [disabled]="isDisabled" given that the isDisabled property exists.

<button md-button disabled>OFF</button>
<button md-raised-button [disabled]="isDisabled">OFF</button>
<button md-mini-fab [disabled]="isDisabled"><md-icon>check</md-icon></button>

Output:

Accessibility

  • In high contrast mode, a strong border is added to the button to make it easier to see.
  • Button focus events originating from the keyboard will retain focus styles, while button focus events from the mouse will not.
  • As md-button is added to an existing button or a tag, it enjoys all the accessibility natively built into these elements.

Upcoming work

We will also be adding ink ripples to buttons in an upcoming milestone.

API Summary

Properties:

| Name | Type | Description | | --- | --- | --- | | color | "primary"|"accent"|"warn" | The color palette of the button | disabled | boolean | Whether or not the button is disabled | disableRipple | boolean | Whether the ripple effect when the button is clicked should be disabled