Tutorial

Getting Started with Shards Vue

Published on September 24, 2018
Default avatar

By Catalin Vasile

Getting Started with Shards Vue

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking 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:

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us


About the authors
Default avatar
Catalin Vasile

author

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
Leave a comment


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel