NuGrid supports smooth row animations when data order changes due to sorting, filtering, or data updates. Animations are disabled by default for performance.
Enable animations with the animation prop:
<template>
<NuGrid
:data="data"
:columns="columns"
:animation="{ enabled: true }"
/>
</template>
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable row animations |
preset | string | 'refresh' | Animation preset to use |
duration | number | 300 | Animation duration in milliseconds |
easing | string | 'ease-out' | CSS easing function |
stagger | number | 15 | Delay between each row's animation |
maxStagger | number | 120 | Maximum total stagger delay |
Choose from built-in animation presets:
Subtle fade with small translate, similar to AG Grid:
<NuGrid :animation="{ enabled: true, preset: 'refresh' }" />
Simple opacity transition:
<NuGrid :animation="{ enabled: true, preset: 'fade' }" />
Slide up from below:
<NuGrid :animation="{ enabled: true, preset: 'slide' }" />
Subtle scale with fade:
<NuGrid :animation="{ enabled: true, preset: 'scale' }" />
Adjust animation timing for your use case:
<template>
<NuGrid
:data="data"
:columns="columns"
:animation="{
enabled: true,
duration: 400,
easing: 'ease-in-out',
stagger: 20,
maxStagger: 200,
}"
/>
</template>
| Easing | Description |
|---|---|
ease-out | Fast start, slow end (default) |
ease-in-out | Slow start and end |
ease-in | Slow start, fast end |
linear | Constant speed |
| Custom | Any valid CSS easing, e.g., cubic-bezier(0.4, 0, 0.2, 1) |
The stagger option creates a wave effect where each row starts animating slightly after the previous one:
<template>
<NuGrid
:data="data"
:columns="columns"
:animation="{
enabled: true,
stagger: 25, // 25ms delay between each row
maxStagger: 150, // Cap total delay at 150ms
}"
/>
</template>
The maxStagger option prevents long delays when animating many rows.
Disable animations by setting animation to false:
<template>
<NuGrid
:data="data"
:columns="columns"
:animation="false"
/>
</template>
NuGrid uses Vue's TransitionGroup with FLIP (First, Last, Invert, Play) animations:
This technique provides smooth animations that work regardless of how the data changes.
Animations trigger automatically when sorting changes row order:
<script setup lang="ts">
const sorting = ref([{ id: 'name', desc: false }])
function toggleSort() {
sorting.value = [{ id: 'name', desc: !sorting.value[0]?.desc }]
}
</script>
<template>
<NuGrid
v-model:sorting="sorting"
:data="data"
:columns="columns"
:animation="{ enabled: true }"
/>
</template>
Animations apply when filtering changes the visible rows:
<script setup lang="ts">
const columnFilters = ref([])
function filterByStatus(status: string) {
columnFilters.value = [{ id: 'status', value: status }]
}
</script>
<template>
<NuGrid
v-model:column-filters="columnFilters"
:data="data"
:columns="columns"
:animation="{ enabled: true }"
/>
</template>
Animations work with virtualized grids:
<template>
<NuGrid
:data="data"
:columns="columns"
:animation="{ enabled: true }"
:virtualization="{ enabled: true }"
/>
</template>
linear easing for smoother large-batch animationsmaxStagger cautiously to avoid perceived lag