Routing

Loading States

Render instant skeleton shapes while TanStack Start routes load data or download chunks.

While a route's loader runs or its code chunk downloads, TanStack Router displays a pending component. VitNode provides pre-built skeleton layouts matching common UI patterns.

Quick start

1. In a Plugin Component (Suspense)

Plugin routes load dynamically. Use React Suspense with VitNode's pending skeletons:

plugins/blog/src/routes/posts-page.tsx
import { FeedPendingSkeleton } from "@vitnode/core/tanstack/pending"
import React, { Suspense } from "react"

const PostsList = () => {
  // Data loading component
  return <div>Posts List</div>
}

const PostsPage = () => (
  <Suspense fallback={<FeedPendingSkeleton />}>
    <PostsList />
  </Suspense>
)

export default PostsPage

2. In an Application Route File

Attach pendingComponent directly to createFileRoute:

apps/web/src/routes/_main/posts.tsx
import { createFileRoute } from "@tanstack/react-router"
import { FeedPendingSkeleton } from "@vitnode/core/tanstack/pending"

export const Route = createFileRoute("/_main/posts")({
  loader: async () => await fetchPosts(),
  component: PostsPage,
  pendingComponent: FeedPendingSkeleton, 
})

Pre-Built Pending Skeletons

Import these shapes from @vitnode/core/tanstack/pending:

ShapeLayoutTypical Use Case
FeedPendingSkeletonCard timeline with avatarsActivity feeds, search results, articles
TablePendingSkeletonToolbar, table header, and rowsData tables, AdminCP lists, files
FormPendingSkeletonCard with inputs and button actionsSettings pages, edit dialogs
CardsPendingSkeletonResponsive 1/2/3 column card gridDashboard overview, integrations
AuthPendingSkeletonCentered authentication cardSign in, registration, password reset
RoutePendingSpinnerCentered accessible spinnerMinimalistic or unconventional pages

Skeleton Props

Standard skeleton shapes accept custom classes and row counts:

Prop

Type

Learn More