Sparkline

The sparkline component can be used to create simple graphs, like GitHub's contribution chart.

Any SVG attribute may be used in addition to the ones listed below.

Utilização

The sparkline component comes in 2 variations, trend(default) and bar. Each support a multitude of options for customizing the look and feel of the sparkline.

API

v-sparkline
Nome
auto-draw
Padrão
false
Tipos
boolean

Components.Sparklines.

Nome
auto-draw-duration
Padrão
2000
Tipos
number

Components.Sparklines.

Nome
auto-draw-easing
Padrão
'ease'
Tipos
string

Components.Sparklines.

Nome
auto-line-width
Padrão
false
Tipos
boolean

Components.Sparklines.

Nome
color
Padrão
'primary'
Tipos
string

Components.Sparklines.

Nome
fill
Padrão
false
Tipos
boolean

Components.Sparklines.

Nome
gradient
Padrão
[]
Tipos
array

Components.Sparklines.

Nome
gradient-direction
Padrão
'top'
Tipos
string

Components.Sparklines.

Nome
height
Padrão
75
Tipos
string | number

Define a altura do componente

Nome
label-size
Padrão
7
Tipos
number | string

Components.Sparklines.

Nome
labels
Padrão
[]
Tipos
array

Components.Sparklines.

Nome
line-width
Padrão
4
Tipos
string | number

Components.Sparklines.

Nome
padding
Padrão
8
Tipos
string | number

Components.Sparklines.

Nome
show-labels
Padrão
false
Tipos
boolean

Components.Sparklines.

Nome
smooth
Padrão
false
Tipos
boolean | number | string

Components.Sparklines.

Nome
type
Padrão
'trend'
Tipos
string

Components.Sparklines.

Nome
value
Padrão
[]
Tipos
array

Controla visibilidade

Nome
width
Padrão
300
Tipos
number | string

A largura do conteúdo

Exemplos

Take a break

For concise information, a complete chart might be overkill. Using a trend line with gradient provides enough detail for the user without showing too much information.

Dashboard card

The v-sparkline component pairs nicely with v-card and v-sheet to create customized information cards, perfect for admin dashboards. Here we use custom labels to provide additional context for the sparkline.

Custom labels

By providing a scoped slot label, we are able to modify the displayed content adding a dollar sign ($). This slot is exclusively for text content. For more information on the svg <text> element, navigate here.

Fill

You can create a v-sparkline with fill using the fill property.

Edit this page | language on Github
Vuetify 3 is now available!The latest version of Vuetify is now available!
Learn about Vuetify 3's new features and functionality for modern Vue applications
Start exploringExplore