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

@mozaic-ds/vue

v0.54.0

Published

Vue.js implementation of Mozaic Design System

Downloads

526

Readme

Introduction

Mozaic-Vue is the Vue.js implementation of Mozaic Design System

Note that this package is built to be used with Vue.js version 2.

You can have an overview of each component of this library by visiting the dedicated Storybook: Storybook

Installation

PREREQUISITE: To allow you to include and use our package in your library, we assume that you are using a module bundlers like Webpack, Parcel or rollup.js, or that your project has been initiated with Vue CLI. Otherwise, the package might not work.

In order to use Mozaic-Vue in your Vue.js project, you must first install the npm package:

$ npm install @mozaic-ds/vue --save --save-exact

Or with Yarn:

$ yarn add @mozaic-ds/vue -E

Usage

Mozaic-Vue is a component library that responds to the different usage contexts proposed by Vue.js.

Indeed, as indicated in its documentation, Vue.js proposes to register/use the components in a global or local way:

  • The global import allows you to make your components accessible throughout your application
  • The local import, on the other hand, makes a component accessible only in the part of the application that uses it

Learn more about the notion of global/local registration on the Vue.js documentation

Global import

Import all components

The easiest way to start using Mozaic-Vue, is to import all the components and make them available throughout your application.

To do this, in your entry point file, insert the following code:

// In the entry point file of your application - usually src/main.js

import MozaicVue from '@mozaic-ds/vue';
import '@mozaic-ds/vue/dist/mozaic-vue.css'; // Import the css of all components

Vue.use(MozaicVue);

NOTE: If you are working on a project that requires the use of the ADEO theme, you should use the following style sheet: import '@mozaic-ds/vue/dist/mozaic-vue.adeo.css';

Import only the desired components

If you do not want to use all the components of the library, but only some of them, you can proceed as follows:

// In the entry point file of your application - usually src/main.js

import { MAccordion, MButton } from '@mozaic-ds/vue';
import '@mozaic-ds/vue/dist/mozaic-vue.css'; // Import the css of all components

Vue.use(MAccordion);
Vue.use(MButton);

NOTE: As you can see, the way to import the CSS is the same for both the import of individual components and the import of all components. Indeed, it is not possible to split the generated CSS file. If you want to import only the CSS related to your individual component import, it may be better to use the local import method described below.

Use the component

That's it! You are now able to use the Mozaic components in your Vue.js project.

Simply call the component of your choice at the desired location anywhere in your application:

<MButton label="Default button" />

Local import

If you want to import a component locally, you can proceed as follows:

// In one the .vue file of your application

<script>
...
import { MButton } from '@mozaic-ds/vue/src/components/button';
...
components: {
  MButton,
},
...
</script>

About the CSS of locally imported components

Regarding CSS, you should know that Mozaic components embed their styles in SCSS format; and that Mozaic uses Dart Sass x PostCSS to interpret and build the final CSS.

Therefore, for your local import to work perfectly, you need to create a vue.config.js file at the root of your project.

Inside this file, you will have to configure your module bundler to use Sass loader x PostCSS loader (or equivalents) to interpret the SCSS code of Mozaic components..

For that, we recommend you to get the code present in the following file => vue.config.js for Mozaic

Then insert it in your vue.config.js file.

Use the component

That's it! You are now able to use the Mozaic components in your Vue.js project.

Simply call the component as follows:

<MButton label="Default button" />