Skip to content

Skillbill/vuelace-3

Repository files navigation

License: MIT npm version

Vuelace-3

Vuelace-3

Vuelace-3 is a powerful UI component library built on top of Shoelace, designed to streamline the process of creating beautiful and responsive user interfaces for Vue.js applications leveraging the reliability of web components

Recommended IDE Setup

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

Type Support for .vue Imports in TS

TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:

  1. Disable the built-in TypeScript Extension
    1. Run Extensions: Show Built-in Extensions from VSCode's command palette
    2. Find TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
  2. Reload the VSCode window by running Developer: Reload Window from the command palette.

Project Setup

npm install

Compile and Hot-Reload for Development

npm run dev
npm run storybook

Type-Check, Compile and Minify for Production

npm run build

Lint with ESLint

npm run lint

Installation

Using npm

Vuelace-3 is available at npm. To install the library inside your project run:

npm i @skillbill/vuelace-3

Local installation

  • download and build the library
npm i
npm run build
  • install the library locally adding the following line to the dependecies inside your package.json
   "@skillbill/vuelace-3": "file:/path/to/the/lib/vuelace-3"

Usage

Init

  • import library style and install function inside your entry file (default is main.js for Vue-based projects)
import { createApp } from 'vue'

import '@skillbill/vuelace-3/styles/vuelace.css'
import '@skillbill/vuelace-3/styles/theme_primevue.css'
import { installVuelace } from '@skillbill/vuelace-3'

import App from './App.vue'

const app = createApp(App)

installVuelace(app)

app.mount('#app')

Add icons

By default, the library uses Material Design Icons. However, not all icons are available to mantain a lightweight package size. It is possible to add/override current icons (icons must be svgs from any source) using the exposed functions:

Example adding an icon using MDI svgs

import cat from '@mdi/svg/svg/cat.svg'
import { addIcon } from '@skillbill/vuelace-3'

addIcon('cat', cat)

Then the icon is available and can be used as follows:

<VLIcon name="cat"></VLIcon>

Customize colors

It is possible to customize colors overriding shoelace design tokens inside your .css

Example

:root {
  --sl-color-primary-50: var(--color-purple-50);
  --sl-color-primary-100: var(--color-purple-100);
  --sl-color-primary-200: var(--color-purple-200);
  --sl-color-primary-300: var(--color-purple-300);
  --sl-color-primary-400: var(--color-purple-400);
  --sl-color-primary-500: var(--color-purple-500);
  --sl-color-primary-600: var(--color-purple-600);
  --sl-color-primary-700: var(--color-purple-700);
  --sl-color-primary-800: var(--color-purple-800);
  --sl-color-primary-900: var(--color-purple-900);
  --sl-color-primary-950: var(--color-purple-950);
}

Contribution 🤝

We welcome contributions from the community. If you find any issues or have ideas for improvements, please open an issue or submit a pull request. 🤝