SpreadsheetGrid
Guides

Motion

Turning animations / transitions on (the motion prop) and adjusting them with CSS tokens

The grid's motion (the active cell outline following, popovers appearing, rows moving on sort, the loading shimmer and so on) is controlled all at once with the motion prop. The default is 'auto', which respects the OS / browser "reduce motion" setting.

<SpreadsheetGrid motion="auto" ... />  // 'auto' (default) | 'on' | 'off'
ValueBehavior
'auto''off' if prefers-reduced-motion: reduce is on, otherwise 'on'. Follows changes to the setting too.
'on'Moves regardless of the OS setting.
'off'Stops everything (the result on screen is the same; it switches instantly).

Demo

Rows 10 of 10Columns 5 of 5Sort: —
#
1
2
3
4
5
6
7
8
9
10
Rows 10 of 10Columns 5 of 5
Cell —Range —0 cells / 0 rows0 columns
  • To make it easy to see, the demo starts with motion="on" (moves regardless of the OS "reduce motion" setting). With the default 'auto', nothing moves in environments where that setting is on.
  • Rows moving / fading in: press "Sort by stock, descending" / "Clear the sort" (sorting from the column menu ⋮ works the same), or "Shuffle rows and replace them" (animateRows).
  • Flash on changed cells: press "Outside update", or edit, paste or Ctrl/Cmd+Z stock / unit prices (highlightChanges).
  • Dotted line around the copied range: select a range and press Ctrl/Cmd+C. Esc clears it (showCopyRange).
  • Hover crosshair: set hoverHighlight to cross and put the pointer over a cell.
  • Active cell outline following: the outline slides with arrow keys and clicks. Try the live display for row drag in row drag, the live display for column drag in column drag, and save state marks in the SSRM demo.

List of effects

EffectDefaultTokenNotes
Active cell outline / selection followingOn--ssg-motion-fastWith keyboard moves / clicks, the outline slides to the new position. While scrolling and while dragging a range with the pointer, it follows instantly.
Popovers / menus appearingOn--ssg-motion-fastThe column menu, context menu, filters, tool panel, select options and date panel fade in from 4px above (appearing only).
Rows moving on sort / filter / group open-closeOn (animateRows)--ssg-motion-baseRendered rows slide to their new positions. Automatically off for auto-height rows and SSRM.
Fade-in of rows that appear without scrollingOn (animateRows)--ssg-motion-baseRows entering the window by sorting, child rows of opened groups and rows of replaced rows fade in from top to bottom. Rows appearing within 1 second of the previous rows appearing (tables re-sorted as values change often and so on) show right away without fading, to avoid flicker (since 1.0.2).
Moving dotted line around the copied rangeOn (showCopyRange)—After Ctrl/Cmd+C, the same dotted line as Excel flows around the copied range. Esc and starting an edit clear it.
Hover crosshairOpt-in (hoverHighlight: 'cross')—Besides the pointer's row, tints the column header, the row number and other cells in the same column lightly (a static highlight).
Flash on changed cells + number tweenOpt-in (highlightChanges)--ssg-motion-slow / --ssg-motion-baseCells whose values changed glow briefly in the accent color, and numbers count up from the old value to the new one. You can see "what changed" with outside updates, paste and undo.
Per-cell save stateOn (showSaveStatus, on SSRM write-back)--ssg-motion-base / --ssg-motion-slowSaving stripes + spinner → ✓ badge. Failure shakes + red flash + ✕ and a chip below the cell.
Live room-making for row dragOpt-in (rowDragMotion: 'live')Fixed at 160msThe grabbed row follows the pointer, and rows it passes make room on the spot.
Live room-making for column dragOpt-in (columnDragMotion: 'live')Fixed at 160msThe grabbed column follows the pointer, and columns it passes make room left or right on the spot. When crossing pinned panes, a copy of the column (a floating column) follows, with a pin / move arrow icon on its header. Demo in column drag.
Loading shimmer and fade-in of arriving rowsOn--ssg-motion-baseWhile SSRM fetches, a band of light flows over the skeleton, and cells of arriving rows fade in from 3px below, from top to bottom. Rows entering and leaving by scrolling aren't covered.
Small transitionsOn--ssg-motion-fastFading of header action icons, checkboxes, the tab indicator, tooltips and the scroll position indicator.

Row reorder animation (animateRows)

<SpreadsheetGrid animateRows ... />  // default true. false stops only rows moving / fading in
  • With sorting, filtering, opening and closing groups, and replacing rows, rendered rows slide to their new positions. Rows leaving the virtualization window disappear immediately, and rows entering it fade in.
  • With auto-height rows (autoHeight) and serverSide (dataSource), it's automatically off, since it interferes with measuring row heights and arriving blocks.
  • The slide after dropping in row drag works as before (independent of animateRows).

Flash on changed cells (highlightChanges)

<SpreadsheetGrid highlightChanges ... />  // default false
  • When rows changes, cells whose values changed glow briefly in the accent color, and default numeric cells count up from the old value to the new one (displayed through valueFormatter). Cell editing, paste, clear, undo / redo and replacing rows from outside are all covered.
  • clientSide only (SSRM write-back is covered by "per-cell save state"). Only rendered cells are covered; with more than 200 changed cells it only flashes, and with more than 2,000, with row insertion / removal / reordering, or with more than 5,000 rows whose references changed (data reloads), it does nothing.
  • renderCell columns only flash (counting up is for default cells only).
  • On screens that replace rows many times a second (price boards, log monitoring and so on), the flash and count-up load the main thread (in a table where many visible cells change every 250ms, main-thread usage was about 2× that without it, in our measurement). We recommend not using it on such screens. Setting the tokens --ssg-motion-slow (flash) / --ssg-motion-base (count-up) to 0ms makes it lighter, but affects other motion too.

Per-cell save state (showSaveStatus)

With serverSide (dataSource.updateRows) write-back, committed cells show a save state mark (default true).

  • Saving: stripes flow over the cell, with a small spinner in the top right.
  • Success: a green ✓ badge shows for 1.3 seconds and disappears.
  • Failure: the cell shakes and glows red, and a ✕ badge plus a chip below the cell reading 「保存に失敗しました。値を戻しました」 ("Couldn't save. The value was restored." in English) show for 4 seconds (scrolling hides them). The existing save failure bar and onServerSideWriteError work as before.
<SpreadsheetGrid dataSource={dataSource} showSaveStatus={false} />  // no marks

Marks are added with the data-ssg-save="pending" | "ok" | "failed" attribute and a .ssg-save-indicator element, so colors can be changed with tokens (--ssg-save-pending / --ssg-save-ok / --ssg-save-failed; the mark text colors are --ssg-save-ok-contrast / --ssg-invalid-contrast).

Adjusting speed (CSS tokens)

Each effect refers only to 3 duration tokens and an easing. You can adjust them all at once by overriding the tokens on .ssg-root.

.ssg-root {
  --ssg-motion-fast: 100ms;   /* default 140ms: active cell outline following, popovers appearing */
  --ssg-motion-base: 200ms;   /* default 260ms: rows moving, open-close */
  --ssg-motion-slow: 450ms;   /* default 600ms: one-off highlights like the changed-cell flash */
  --ssg-motion-ease: ease-out; /* default cubic-bezier(0.2, 0.8, 0.2, 1) */
}

With 'off' (or 'auto' + reduce motion), the grid itself and popovers / menus / panels / drag ghosts / tooltips get .ssg-motion-off, and the duration tokens become 0. They're defined with :where (specificity 0), so you can bring back specific effects even while stopped.

/* keep the active cell outline following even while stopped */
.ssg-root.ssg-motion-off {
  --ssg-motion-fast: 140ms;
}

Notes

  • With SSR (Next.js and so on), 'auto' first renders as 'on' and resolves again on the client after hydration (the same as theme='auto').
  • Earlier effects that looked at prefers-reduced-motion directly (the tool panel flash, the filter options spinner, the scroll position indicator fade) are decided by the effective value of motion too. With 'auto' the behavior is the same as before.

On this page