Basic UI Elements
We have use bootstrap to design most of the components, make sure you install it and integrate with the project.
step 1:
npm install --save bootstrap
step 2:
In your main.ts file all the following code:
import 'bootstrap/dist/css/bootstrap.css'
Buttons Preview link
<button class="btn " :class="item.classes" v-for="(item, index) in button " :key="index" type="button">
{{ item.title }}
</button>
Inside Your script tags add
import { button } from "@/core/data/buttons"
Inside ts add
interface Button {
classes: string,
title: string
}
export const button: Button[] = [
{
classes: "btn-primary",
title: "Primary Button"
},
{
classes: "btn-secondary",
title: "Secondary Button"
},
{
classes: "btn-info text-light",
title: "Info Button"
},
{
classes: "btn-success",
title: "Success Button"
},
{
classes: "btn-warning text-light",
title: "Warning Button"
},
{
classes: "btn-danger",
title: "Danger Button"
},
{
classes: "btn-light text-dark",
title: "Light Button"
}
]
Tag & pills Preview link
Inside Your template tags add
<span class="badge " :class="item.class" v-for="(item, index) in badges" :key="index">{{item.title}}</span>
Inside Your script tags add
import { badges } from "@/core/data/uikits"
Inside ts add
interface Badges {
class: string,
title: string
}
export const badges: Badges[] = [
{
class: "badge-primary",
title: "Primary"
},
{
class: "badge-secondary",
title: "Secondary"
},
{
class: "badge-success",
title: "Success"
},
{
class: "badge-info",
title: "Info"
},
{
class: "badge-warning",
title: "Warning"
},
{
class: "badge-danger",
title: "Danger"
},
{
class: "badge-light text-dark",
title: "Light"
},
{
class: "badge-dark tag-pills-sm-mb",
title: "Dark"
}
]
Progressbar Preview link
Inside Your template tags add
<div v-for="(item, index) in basic" :key="index">
<div class="progress-bar " :class="item.class" role="progressbar" :style="{ 'width': item.width }"
aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">{{item.width}}</div>
</div>
Inside Your script tags add
import { basic } from "@/core/data/uikits"
Inside json add
interface Progress {
width: string,
class: string
}
export const basic: Progress[] = [
{
width: " 25%",
class: "bg-primary"
},
{
width: "50%",
class: "bg-secondary"
},
{
width: "75%",
class: "bg-success"
},
{
width: "100%",
class: "bg-info"
}
]
Alert Preview link
<div class="alert alert-primary" role="alert">The <a class="alert-link text-white" href="#">"alert-primary"</a> class can be used to create an alert like this one.</div>
<div class="alert alert-secondary" role="alert">The <a class="alert-link text-white" href="#">"alert-secondary"</a> class can be used to create an alert like this one.</div>
<div class="alert alert-success" role="alert">The <a class="alert-link text-white" href="#">"alert-success"</a> class can be used to create an alert like this one.</div>
<div class="alert alert-info" role="alert">The <a class="alert-link text-white" href="#">"alert-info"</a> class can be used to create an alert like this one.</div>
<div class="alert alert-warning" role="alert">The <a class="alert-link text-white" href="#">"alert-warning"</a> class can be used to create an alert like this one.</div>
<div class="alert alert-danger" role="alert">The <a class="alert-link text-white" href="#">"alert-danger"</a> class can be used to create an alert like this one.</div>
<div class="alert alert-light" role="alert">The <a class="alert-link text-dark" href="#">"alert-light"</a> class can be used to create an alert like this one.</div>
<div class="alert alert-dark" role="alert">The <a class="alert-link text-white" href="#">"alert-dark"</a> class can be used to create an alert like this one.</div>
Popover Preview link
<button type="button" class="btn btn-primary example-popover mr-1" data-bs-toggle="popover" title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
<a tabindex="0" class="example-popover btn btn-secondary" role="button" data-bs-toggle="popover" data-bs-trigger="focus" title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a>
<button type="button" data-bs-trigger="hover" class="example-popover btn btn-success" data-container="body" data-bs-toggle="popover" data-bs-placement="bottom" title="Popover title" data-offset="-20px -20px" data-bs-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." >On Hover Tooltip</button>
Tooltip Preview link
Inside Your template tags add
<button class="example-popover btn btn-primary" type="button" data-container="body"
data-bs-toggle="tooltip" data-bs-placement="top" v-tooltip title="Popover title" ref="hover">Hover Me</button>
Add in config in main.ts
import { Tooltip } from 'bootstrap'
app.directive('tooltip', {
mounted(el) {
new Tooltip(el)
},
unmounted(el) {
const tooltipInstance = Tooltip.getInstance(el)
if (tooltipInstance) tooltipInstance.dispose()
},
})
Dropdown Preview link
<div class="btn-group" v-for="(item, index) in dropdown" :key="index">
<button class="btn dropdown-toggle" :class="item.class" type="button" data-bs-toggle="dropdown"
aria-expanded="false">{{ item.title }}</button>
<ul class="dropdown-menu dropdown-block">
<li v-for="(items, index) in item.children" :key="index">
<a class="dropdown-item" href="#"> {{ items.title }}</a>
</li>
</ul>
</div>
Inside Your script tags add
import { dropdown } from "@/core/data/uikits"
Inside json add
interface BasicDropdown {
class: string,
title: string,
children: Sub[]
}
interface Sub {
title: string
}
export const dropdown: BasicDropdown[] = [
{
class: "btn-primary",
title: "Dashboard",
children: [
{
title: "Project"
},
{
title: "Ecommerce"
},
{
title: "Crypto"
}
]
},
{
class: "btn-secondary",
title: "Ecommerce",
children: [
{
title: "Product"
},
{
title: "Product details"
},
{
title: "Cart"
}
]
},
{
class: "btn-warning text-white",
title: "Ui kits",
children: [
{
title: "Typography"
},
{
title: "Avatars"
},
{
title: "Grid"
}
]
},
{
class: "btn-danger",
title: "Error page",
children: [
{
title: "Error 400"
},
{
title: "Error 403"
},
{
title: "Error 500"
}
]
}
]
Tab Preview link
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Inside Your template tags add
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item"><a class="nav-link active" id="home-tab" data-bs-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a></li>
<li class="nav-item dropdown"><a class="nav-link dropdown-toggle bg-transparent border-none" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false" @click="open()">Dropdown</a>
<div class="dropdown-menu" :class="filter ? 'show' : ''"><a class="dropdown-item" id="profile-tab" data-bs-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Action</a><a class="dropdown-item" href="#">Another action</a><a class="dropdown-item" href="#">Something else here</a><a class="dropdown-item" href="#">Separated link</a></div>
</li>
<li class="nav-item"><a class="nav-link" id="profile-tabs" data-bs-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a></li>
<li class="nav-item"><a class="nav-link" id="contact-tab" data-bs-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false">Contact</a></li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
<p class="mb-0 m-t-30">{{description}}</p>
</div>
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
<p class="mb-0 m-t-30">{{description}}</p>
</div>
<div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
<p class="mb-0 m-t-30">{{description}}</p>
</div>
</div>
Inside Your script tags add
import { ref } from 'vue';
const filter = ref(false)
const description = ref <string >("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum")
function open() {
filter.value = !filter.value
}
Accordion Preview link
Inside Your template tags add
<Card :cardClass="'height-equal'" :headerTitle="'Simple Accordion'" :border="true" :padding="false">
<template #header5>
<p class="f-m-light mt-1">Drop the <code>collapsed </code> class from the <code> accordion-button </code>element and set its aria-expanded attribute to true.</p>
</template>
<div class="accordion dark-accordion" id="simple-accordion">
<div class="accordion-item" v-for="accordion in simpleAccordion" :key="accordion.id">
<h2 class="accordion-header" :id="`heading-${accordion.id}`">
<button @click="toggleAccordion(accordion.id)" class="accordion-button accordion-light-primary txt-primary" :class="{ collapsed: !visibleAccordion.includes(accordion.id) }" type="button">
{{ accordion.title }}
<vue-feather :type="'chevron-down'" :class="'svg-color'" />
</button>
</h2>
<div class="accordion-collapse collapse" :class="{ show: visibleAccordion.includes(accordion.id) }">
<div class="accordion-body" v-html="accordion.description"></div>
</div>
</div>
</div>
</Card>
Inside Your script tags add
import { ref, defineAsyncComponent } from 'vue';
import { simpleAccordion } from '@/core/data/uiKits/accordion';
const Card = defineAsyncComponent(() => import('@/components/shared/card/Card.vue'));
let visibleAccordion = ref<number[]>([1]);
function toggleAccordion(id: number) {
if (visibleAccordion.value && visibleAccordion.value.includes(id)) {
visibleAccordion.value = visibleAccordion.value.filter(item => item !== id);
} else {
visibleAccordion.value.push(id);
}
}
Inside json add
export const simpleAccordion = [
{
id: 1,
title: 'Accordion Item #1',
description: `This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body , though the transition does limit overflow.`,
},
{
id: 2,
title: 'Accordion Item #2',
description: `This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body , though the transition does limit overflow.`,
},
{
id: 3,
title: 'Accordion Item #3',
description: `This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body , though the transition does limit overflow.
`,
},
];