NuGrid supports smooth row animations when data order changes due to sorting, filtering, or data updates.
Enable animations with the animation prop:
<template>
<NuGrid
:data="data"
:columns="columns"
:animation="{ enabled: true }"
/>
</template>
Configure animation behavior:
<template>
<NuGrid
:data="data"
:columns="columns"
:animation="{
enabled: true,
duration: 300,
easing: 'ease-out',
preset: 'refresh',
}"
/>
</template>
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable row animations |
duration | number | 300 | Animation duration in milliseconds |
easing | string | 'ease-out' | CSS easing function |
preset | string | 'refresh' | Animation preset |
ease-out - Fast start, slow end (default)ease-in-out - Slow start and endease-in - Slow start, fast endlinear - Constant speedrefresh - Standard FLIP animation (default)fade - Fade in/out effectslide - Slide from sidescale - Scale effectSet to false to disable:
<template>
<NuGrid
:data="data"
:columns="columns"
:animation="false"
/>
</template>
NuGrid uses Vue's TransitionGroup with FLIP animations:
Animations work with virtualized grids:
<template>
<NuGrid
:data="data"
:columns="columns"
:animation="{ enabled: true, duration: 300 }"
:virtualization="{ enabled: true }"
/>
</template>
<script setup lang="ts">
import type { NuGridColumn, NuGridAnimationOptions } from '#nu-grid/types'
const data = ref([...initialData])
const animationOptions: NuGridAnimationOptions = {
enabled: true,
duration: 300,
easing: 'ease-out',
preset: 'refresh',
}
const columns: NuGridColumn<Task>[] = [
{ accessorKey: 'id', header: 'ID' },
{ accessorKey: 'name', header: 'Name' },
{ accessorKey: 'status', header: 'Status' },
]
function shuffleData() {
data.value = [...data.value].sort(() => Math.random() - 0.5)
}
function sortByName() {
data.value = [...data.value].sort((a, b) => a.name.localeCompare(b.name))
}
</script>
<template>
<div class="space-y-4">
<div class="flex gap-2">
<UButton @click="shuffleData">Shuffle</UButton>
<UButton @click="sortByName">Sort by Name</UButton>
</div>
<NuGrid
:data="data"
:columns="columns"
:animation="animationOptions"
/>
</div>
</template>
linear easing for smoother large-batch animations