Tutorial

Getting Started with Shards Vue

Vue.js

While this tutorial has content that we believe is of great benefit to our community, we have not yet tested or edited it to ensure you have an error-free learning experience. It's on our list, and we're working on it! You can help us out by using the "report an issue" button at the bottom of the tutorial.

Shards Vue is a beautiful and modern Vue.js UI toolkit packed with dozens of custom pre-built components that you can use to kick-start your next app.

The library was built from scratch with the goals of having a very small footprint and providing powerful components that are easy to use.

The library is based on the core Shards UI kit and Bootstrap 4, so if you’re already familiar with Bootstrap 4, you’ll feel right at home while using Shards Vue.

Shards Vue preview

Getting started with Shards Vue is easy.

1. Installation

First, make sure to install the library via npm or Yarn, depending on how your project was set-up:

$ yarn add shards-vue    # Install via Yarn
$ npm install shards-vue # Or install via NPM

2. Registration

The next step is to include the base Shards and Bootstrap stylesheets and register the library inside your app’s entrypoint. You can achieve that with just a few lines of code:

import Vue from 'vue'
import ShardsVue from 'shards-vue'

import 'bootstrap/dist/css/bootstrap.css'
import 'shards-ui/dist/css/shards.css'

Vue.use(ShardsVue);

3. You are ready!

That’s it! You are now ready to build sleek user interfaces using Shards Vue inside your Vue templates. Here’s a very small example of what you can create using Shards Vue.

<template>
  <div class="main-wrapper">
    <d-navbar toggleable="md" type="dark" theme="primary">
      <d-container>
      <d-navbar-toggle target="nav-collapse"></d-navbar-toggle>
      <d-navbar-brand>
          <h6 class="text-white my-auto mr-4">Shards Vue</h6>
      </d-navbar-brand>
      <d-collapse is-nav id="nav-collapse">
        <d-navbar-nav>
            <d-nav-item href="#">Home</d-nav-item>
            <d-nav-item href="#">About</d-nav-item>
            <d-nav-item href="#">Services</d-nav-item>
        </d-navbar-nav>
      </d-collapse>
      <d-btn theme="white" size="sm" outline>Contact</d-btn>
      </d-container>
    </d-navbar>
    <d-container class="py-4">
      <h5 class="mb-4">Add New Post</h5>
      <d-card class="w-100">
        <d-card-body class="p-3">
          <d-form>
            <d-form-row>
              <d-input class="mb-3" placeholder="Post title" />
            </d-form-row>
            <d-form-row>
              <d-textarea class="mb-3" placeholder="Post content" :rows="6" />
            </d-form-row>
            <d-form-row class="justify-content-between">
              <d-button size="sm" type="submit">Publish</d-button>
              <d-button size="sm" outline theme="warning" class="ml-auto">Cancel</d-button>
            </d-form-row>
          </d-form>
        </d-card-body>
      </d-card>
    </d-container>
  </div>
</template>

<style>
.main-wrapper {
  background: #f9f9f9;
  min-height: 100vh;
}
</style>

And here’s the resulting UI:

Demo example of a small application created with Shards Vue

Here are a couple of links that you can follow to learn more about Shards Vue:

0 Comments

Creative Commons License