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-3

v0.72.0

Published

Vue.js implementation of Mozaic Design System

Downloads

5,061

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 3.

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-3 --save --save-exact

Or with Yarn:

$ yarn add @mozaic-ds/vue-3 -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-3';
import '@mozaic-ds/vue-3/dist/mozaic-vue.css'; // Import the css of all components (158ko)

const app = createApp(App);
app.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-3/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-3';
import '@mozaic-ds/vue-3/dist/mozaic-vue.css'; // Import the css of all components (158ko)

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-3/src/components/button';
...
components: {
  MButton,
},
...
</script>

By doing this import you will be able to get the HTML & JS part of the desired Mozaic component.

About the CSS of locally imported components

Concerning the style part, you should know that Mozaic components embed their styles in SCSS format; and that Mozaic uses PostCSS to interpret and build the final CSS.

Therefore, for your local import to work perfectly, you still need to perform one last step, namely 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 PostCSS to interpret the SCSS of Mozaic components.

For that, we recommend you to get the code present in the following file: Custom vue.config.js

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" />