A flexible and customizable timeline component for Vue 3 applications.
Display a vertical timeline of events with customizable styles, alignments, and content.
For both light and dark themes. 🌝 🌚
Feel free to report issues, make PR's and start discussions.
- Customizable bullets style: filled or outlined
- Custom colors
- Left and right alignment
- Support for light and dark mode
npm install v-tmline
Import and use the component in your Vue application:
<script setup>
import { Timeline } from 'v-tmline'
const timelineItems = [
{
id: 1,
label: 'First Point'
},
{
id: 2,
label: 'Second Point'
},
{
id: 3,
label: 'Third Point'
}
]
</script>
<template>
<Timeline :items="timelineItems" />
</template>
Prop | Type | Default | Description | Available Options |
---|---|---|---|---|
items | Array | required | Array of timeline items. Each item must be an object with at least a label property |
- |
mode | String | 'light' | Theme mode of the timeline | 'light', 'dark' |
fill | String | 'filled' | Style of timeline dots | 'filled', 'outlined' |
colored | String | '' | Custom color for the timeline (CSS color value) | Any valid CSS color |
align | String | 'left' | Alignment of the timeline | 'left', 'right' |
Each item in the items
array should have the following structure:
{
id?: string | number, // Optional unique identifier
label: string // Required text to display
}
<template>
<Timeline :items="[
{ label: 'Started project' },
{ label: 'Released v1.0' },
{ label: 'Added new features' }
]" />
</template>
<template>
<Timeline
:items="timelineItems"
colored="#2196F3"
/>
</template>
<template>
<Timeline
:items="timelineItems"
mode="dark"
/>
</template>
<template>
<Timeline
:items="timelineItems"
align="right"
/>
</template>
You can customize the content of each timeline item using the item
slot:
<template>
<Timeline :items="timelineItems">
<template #item="{ item, index }">
<div class="custom-item">
<h3>{{ item.label }}</h3>
<p>Additional content for item {{ index + 1 }}</p>
</div>
</template>
</Timeline>
</template>
The component uses the following CSS classes that you can override:
.re-timeline
- Main timeline container.re-timeline-item
- Individual timeline item.re-timeline-item-tail
- Timeline connector line.re-timeline-item-head
- Timeline dot.re-timeline-item-content
- Content container
<script setup>
import { Timeline } from 'v-tmline'
const timelineItems = [
{
id: 1,
label: 'Project Started',
},
{
id: 2,
label: 'First Milestone',
},
{
id: 3,
label: 'Project Completed',
}
]
</script>
<template>
<Timeline
:items="timelineItems"
mode="light"
fill="filled"
colored="#2196F3"
align="left"
>
<template #item="{ item }">
<div class="custom-timeline-content">
<h3>{{ item.label }}</h3>
<p>Custom content here</p>
</div>
</template>
</Timeline>
</template>
<style scoped>
.custom-timeline-content {
padding: 10px;
border-radius: 4px;
background-color: #f5f5f5;
}
</style>
Contributions are welcome! Please feel free to submit a Pull Request.