Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vue-material-design-icons

robcresswell136.4kMIT5.3.1

A collection of material design icons as Vue single file components

vue, material design icons, mdi, icons, material, icon, svg, vue.js, material design

readme

Vue Material Design Icon Components

This library is a collection of Vue single-file components to render Material Design Icons, sourced from the MaterialDesign project. It also includes some CSS that helps make the scaling of the icons a little easier.

Getting started

  1. Install the package

    yarn add vue-material-design-icons

    OR

    npm i vue-material-design-icons
  2. Import the icon, and declare it as a local component:

    import MenuIcon from 'vue-material-design-icons/Menu.vue';
    
    components: {
      MenuIcon;
    }

    OR

    Declare it as a global component:

    import MenuIcon from 'vue-material-design-icons/Menu.vue';
    
    Vue.component('menu-icon', MenuIcon);

    Note Icon files are pascal cased, e.g. CheckboxMarkedCircle.vue, and their default name has Icon appended e.g. CheckboxMarkedCircleIcon.

  3. Then use it in your template code!

    <menu-icon />
  4. Optional Add the included stylesheet. This few lines of CSS will cause the icons to scale with any surrounding text, which can be helpful when you primarily style with CSS. Note that if you intend to handle sizing with the size prop, you probably don't want to use this as it may conflict.

    import 'vue-material-design-icons/styles.css';

Props

  • title - This changes the hover tooltip as well as the title shown to screen readers. For accessibility purposes, if a title is not provided, then the icon is hidden from screen readers. This is to force developers to use meaningful titles for their icon usage.

    Example:

    <android-icon title="this is an icon!" />
  • fillColor - This property allows you to set the fill colour of an icon via JS instead of requiring CSS changes. Note that any CSS values, such as fill: currentColor; provided by the optional CSS file, may override colours set with this prop.

    Example:

    <android-icon fillColor="#FF0000" />
  • size - This property overrides the width and height attributes on the SVG. The default is 24.

    Example:

    <android-icon :size="48" />

Icons

A list of the icons can be found at the Material Design Icons website. The icons packaged here are pascal cased versions of the names displayed on the website, to match the Vue Style Guide. For example, the icon named ultra-high-definition would be imported as "vue-material-design-icons/UltraHighDefinition.vue".

Tips

  • Use resolve in your Webpack config to clean up the imports:

    resolve: {
      alias : {
        "icons": path.resolve(__dirname, "node_modules/vue-material-design-icons")
      },
      extensions: [
        ".vue"
      ]
    }

    This will give you much shorter and more readable imports, like import Android from "icons/Android", rather than import Android from "vue-material-design-icons/Android.vue". Much better!

  • If you want custom sizing, add your own css to adjust the height and width of the icons

    .material-design-icon.icon-2x {
      height: 2em;
      width: 2em;
    }
    
    .material-design-icon.icon-2x > .material-design-icon__svg {
      height: 2em;
      width: 2em;
    }

    Then add your size class

    <fullscreen-icon class="icon-2x" />

    While I recommend using CSS for styling, you can also pass in a size prop, detailed in the Props section above.

Credits

Austin Andrews / Templarian for the MaterialDesign project. This supplies the SVG icons for this project, which are packaged as Vue single file components.

Elliot Dahl for this article on prototypr.io. This is where the recommended CSS comes from.

Attila Max Ruf / therufa for the mdi-vue library which inspired this one. It also produces single file components from material design icons.

changelog

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

3.2.0 (2019-04-24)

Features

  • New icons (mdi dep update) (0382799)

3.1.0 (2019-03-04)

Features

  • New icons & dependency upgrades (03b3de1)

3.0.0 (2019-02-03)

Bug Fixes

BREAKING CHANGES

  • This is an extremely cautious breaking change, mostly because an icon library should definitely not cause breakages.

Previously the library required manually added click handlers, which was fine when declaring the icons inline but not helpful when using them programmatically with libraries like Vuetify.

2.8.0 (2019-02-03)

Features

  • Add ability to change size via a prop (d4e76ed)

2.7.0 (2019-02-03)

Features

2.6.0 (2019-01-03)

Features

2.5.0 (2018-12-23)

Bug Fixes

  • A basic size instructions to README (66bf350)
  • IE11 tooltip support (3966a2d)

Features

2.4.0 (2018-11-04)

Features

  • New icons (updated mdi) (236124c)

2.3.0 (2018-10-10)

Features

  • Update to newest version of mdi (208c0ab)

2.2.0 (2018-10-10)

Features

  • Update to newest version of mdi (208c0ab)

2.1.1 (2018-09-03)

Bug Fixes

2.1.0 (2018-09-03)

Features

2.0.0 (2018-08-18)

Features

  • Upgrade MDI & match vue styleguide (cfdf17e), closes #1 #2

BREAKING CHANGES

  • Match the component names to the structure recommended by the Vue style guide. This means all files now begin with a capital letter, i.e. "android.vue" is now "Android.vue", and the component names are Pascal-cased instead of camel-cased. i.e. "CheckboxMarkedCircle" instead of "checkbox-marked-circle".

Other changes include:

  • Async build script, to make it a little faster. Also refactored to use the new @mdi/svg repo, so some of the build hacks can go away.
  • Added some testing and snapshots, to make upgrades quicker to verify.
  • Updated to the lastest version of MDI for more icons.
  • Updated the LICENSE for 2018
  • Added .nvmrc
  • Fairly unimportant, but the generated .vue files now pass all the rules on the Vue style guide; this should make them a little more consistent and easier to read for those familiar with Vue.

1.6.0 (2018-07-22)

Features

1.5.1 (2018-05-28)

Bug Fixes

1.5.0 (2018-05-28)

Features

  • Update to latest version of material design icons (57d4857)

1.4.0 (2018-04-19)

Bug Fixes

  • Make standard-version tag format match existing tags (13ca214)
  • Remove CHANGELOG header for standard-version (cd28237)

Features

  • Add standard-version for easier CHANGELOG creation (826b17d)
  • Upgrade the build tooling (52495c0)
  • Use @mdi/svg from npm instead of git (7542255)

[1.3.0] - 2018-04-02

[1.2.1] - 2018-03-08

Changed

  • Updated styles.css so that it was actually valid CSS. Previously it was SCSS. facepalm

[1.2.0] - 2018-03-07

Changed

  • Updated the MaterialDesign-SVG dependency, adding many new icons
  • Moved the internal tooling to Yarn
  • Slightly changed the repo description wording

[1.1.0] - 2018-02-07

Added

  • Added a fillColor prop that lets you set a fill colour via component prop rather than CSS. Thanks to Sagar Subedi for the change.

Changed

  • Modified the base template to set a default title via prop definition, instead of using a computed prop. This shouldn't make any outward difference, but makes the code a little cleaner.

Fixed

  • Improved the package.json scripts so that they work from a fresh clone of the repo.

[1.0.0] - 2018-01-09

Added

  • Added a "Props" section to the README
  • Added a decorative prop that toggles whether icons are hidden from screen readers. This is false by default (i.e. icons are shown to screen readers)

Changed

  • Changed the icon IDs to classes (i.e. #android-icon is now .android-icon) to avoid invalid HTML when using the same icon multiple times in one page
  • Changed the aria-labelled-by attribute to an aria-label attribute to avoid using duplicate IDs
  • Changed the wrapping element from a <div> to a <span>

[0.8.2] - 2017-12-13

Changed

  • Small improvements to the README, such as extra tips, and formatting fixes

[0.8.1] - 2017-12-11

Fixed

  • Fixed the excessive padding around the title

[0.8.0] - 2017-12-11

Changed

  • Updated the MaterialDesign-SVG dependency, adding many new icons
  • Updated to a new version of mustache
  • Added credit referencing the mdi-vue library

[0.7.1] - 2017-08-06

Added

  • Added a "Tips" section to the README

[0.7.0] - 2017-08-06

Added

  • Added a title prop to the icons, allowing the title to be customised. The default is still <icon-name>-icon, e.g. android-icon

Changed

  • Changed the title ID from <icon-name>-title to <icon-name>-icon-title

[0.6.3] - 2017-07-27

Fixed

  • Added a note about finding the icon list to the README

[0.6.2] - 2017-07-27

Fixed

  • Made the icon source more explicit in the README

[0.6.1] - 2017-07-25

Fixed

  • Added the missing CHANGELOG entry for 0.6.0

[0.6.0] - 2017-07-25

Changed

  • Changed from the MaterialDesign repo to MaterialDesign-SVG repo to take advantage of the smaller repo and compressed paths. Overall, this reduces the size of this repo and its distributed icons. Yay!

[0.5.0] - 2017-07-25

Changed

  • Updated the README to make install steps clearer and added additional credits
  • Small fixes to the CHANGELOG formatting

[0.4.0] - 2017-07-25

Changed

  • The CSS is no longer included in each component by default. It can be optionally added by including vue-material-design-icons/styles.css
  • README updated to include adding the CSS

[0.3.1] - 2017-07-24

Changed

  • Updated the package.json keywords
  • Small fixes to README and CHANGELOG

[0.3.0] - 2017-07-24

Added

  • Added a CHANGELOG to better track updates
  • Added LICENSE to distributed package

Changed

  • Split out CSS from the template file, to reduce the overall package size