Quasar is a popular Vue UI library for developing good looking Vue apps.
In this article, we’ll take a look at how to create Vue apps with the Quasar UI library.
Swipeable Tabs
We can make tabs swipeable with the animated
, swipeable
and infinite
props together:
<!DOCTYPE html>
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons"
rel="stylesheet"
type="text/css"
/>
<link
href="https://cdn.jsdelivr.net/npm/quasar@1.12.13/dist/quasar.min.css"
rel="stylesheet"
type="text/css"
/>
</head>
<body class="body--dark">
<script src="https://cdn.jsdelivr.net/npm/vue@^2.0.0/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/quasar@1.12.13/dist/quasar.umd.min.js"></script>
<div id="q-app">
<q-layout view="lHh Lpr lFf" container style="height: 100vh;">
<div class="q-pa-md">
<q-tab-panels v-model="panel" animated swipeable infinite>
<q-tab-panel name="mails">
<div class="text-h6">Mails</div>
Lorem ipsum
</q-tab-panel>
<q-tab-panel name="alarms">
<div class="text-h6">Alarms</div>
Lorem ipsum
</q-tab-panel>
<q-tab-panel name="movies">
<div class="text-h6">Movies</div>
Lorem ipsum
</q-tab-panel>
</q-tab-panels>
</div>
</q-layout>
</div>
<script>
new Vue({
el: "#q-app",
data: {
panel: "mails"
}
});
</script>
</body>
</html>
Timeline
Quasar comes with a timeline component.
To add it, we write:
<!DOCTYPE html>
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons"
rel="stylesheet"
type="text/css"
/>
<link
href="https://cdn.jsdelivr.net/npm/quasar@1.12.13/dist/quasar.min.css"
rel="stylesheet"
type="text/css"
/>
</head>
<body class="body--dark">
<script src="https://cdn.jsdelivr.net/npm/vue@^2.0.0/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/quasar@1.12.13/dist/quasar.umd.min.js"></script>
<div id="q-app">
<q-layout view="lHh Lpr lFf" container style="height: 100vh;">
<div class="q-pa-md">
<q-timeline color="secondary">
<q-timeline-entry heading>
Timeline heading
</q-timeline-entry>
<q-timeline-entry title="Event Title" subtitle="February 22, 2000">
<div>
Lorem ipsum dolor sit amet
</div>
</q-timeline-entry>
<q-timeline-entry
title="Event Title"
subtitle="February 21, 2000"
icon="delete"
>
<div>
Lorem ipsum dolor sit amet
</div>
</q-timeline-entry>
<q-timeline-entry heading>
November, 2017
</q-timeline-entry>
<q-timeline-entry
title="Event Title"
subtitle="February 22, 2000"
avatar="https://cdn.quasar.dev/img/avatar2.jpg"
>
<div>
Lorem ipsum dolor sit amet
</div>
</q-timeline-entry>
<q-timeline-entry title="Event Title" subtitle="February 22, 2000">
<div>
Lorem ipsum dolor sit amet
</div>
</q-timeline-entry>
<q-timeline-entry
title="Event Title"
subtitle="February 22, 2000"
color="orange"
icon="done_all"
>
<div>
Lorem ipsum dolor sit amet
</div>
</q-timeline-entry>
<q-timeline-entry title="Event Title" subtitle="February 22, 2000">
<div>
Lorem ipsum dolor sit amet
</div>
</q-timeline-entry>
<q-timeline-entry title="Event Title" subtitle="February 22, 2000">
<div>
Lorem ipsum dolor sit amet
</div>
</q-timeline-entry>
</q-timeline>
</div>
</q-layout>
</div>
<script>
new Vue({
el: "#q-app",
data: {
panel: "mails"
}
});
</script>
</body>
</html>
We add the q-timeline
component to add the timeline.
And we add the entries inside the timeline with the q-timeline-entry
component.
The heading
prop renders the entry as a heading.
We can add a q-timeline-entry
without populating the default slot:
<!DOCTYPE html>
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons"
rel="stylesheet"
type="text/css"
/>
<link
href="https://cdn.jsdelivr.net/npm/quasar@1.12.13/dist/quasar.min.css"
rel="stylesheet"
type="text/css"
/>
</head>
<body class="body--dark">
<script src="https://cdn.jsdelivr.net/npm/vue@^2.0.0/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/quasar@1.12.13/dist/quasar.umd.min.js"></script>
<div id="q-app">
<q-layout view="lHh Lpr lFf" container style="height: 100vh;">
<div class="q-pa-md">
<q-timeline color="secondary">
<q-timeline-entry
heading
body="Timeline heading"
></q-timeline-entry>
<q-timeline-entry
title="Event Title"
subtitle="February 22, 2000"
avatar="https://cdn.quasar.dev/img/avatar3.jpg"
:body="body"
>
</q-timeline-entry>
<q-timeline-entry
title="Event Title"
subtitle="February 21, 2000"
icon="delete"
:body="body"
>
</q-timeline-entry>
<q-timeline-entry heading body="November, 2017"></q-timeline-entry>
<q-timeline-entry
title="Event Title"
subtitle="February 22, 2000"
:body="body"
>
</q-timeline-entry>
</q-timeline>
</div>
</q-layout>
</div>
<script>
new Vue({
el: "#q-app",
data: {
body: "Lorem ipsum dolor sit amet"
}
});
</script>
</body>
</html>
We put the content in the body
prop.
Conclusion
We can add swipeable tabs and add a timeline with Quasar.