An open API service indexing awesome lists of open source software.

https://github.com/ir3ne/v-tmline

A flexible and customizable timeline component for Vue 3 applications.
https://github.com/ir3ne/v-tmline

npm npm-package timeline timeline-component vue vuejs

Last synced: 2 months ago
JSON representation

A flexible and customizable timeline component for Vue 3 applications.

Awesome Lists containing this project

README

          


Vue Timeline Component










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.


v-tmline-logo

## Live demo

[Official Documentation](https://ir3ne.github.io/v-tmline/)

## Npm package page

[v-tmline](https://www.npmjs.com/package/v-tmline)

## Features

- Customizable bullets style: filled or outlined
- Custom colors
- Left and right alignment
- Support slots and named slots
- Support for light and dark mode

![dark-light-mode](https://raw.githubusercontent.com/ir3ne/v-tmline/edc69d434e40ed269690d530bc5f67e48010b4ef/assets/dark-light-mode.png)

## Installation

```bash
npm install v-tmline
```

## Usage

Import and use the component in your Vue application:

```vue

import { Timeline } from 'v-tmline'

const timelineItems = [
{
id: 1,
label: 'First Point'
},
{
id: 2,
label: 'Second Point'
},
{
id: 3,
label: 'Third Point'
}
]

```

## Props

| 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' |

## Timeline Items

Each item in the `items` array should have the following structure:

```javascript
{
id?: string | number, // Optional unique identifier
label: string // Required text to display
}
```

## Customization

### Basic Timeline

```vue

```

### Custom Colored Timeline

```vue

```

### Dark Mode Timeline

```vue

```

### Right-Aligned Timeline

```vue

```

### Custom Content using Slots

You can customize the content of each timeline item using the slot feature: default or named slot.

#### Default Slot

```vue




Default: {{ item.label }}


```
#### Named Slot

```vue




💫 {{ item.label }}


{{ item.company }}






📚 {{ item.label }}


{{ item.school }}



```

## Styling

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

## Full Example

```vue

import { Timeline } from 'v-tmline'

const timelineItems = [
{
id: 1,
label: 'Project Started',
},
{
id: 2,
label: 'First Milestone',
},
{
id: 3,
label: 'Project Completed',
}
]




{{ item.label }}


Custom content here




.custom-timeline-content {
padding: 10px;
border-radius: 4px;
background-color: #f5f5f5;
}

```

## License

[MIT License](./LICENSE)

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.