Skip to content
All blocks

[40] Feedback

Loading State

A projects page with the skeleton prop on: the same layout drawn as placeholders while the data loads.

1280px

Copy the code

One file with one component and its sample data. It needs @vaneui/ui and its stylesheet, set up as in the installation guide.

loading.tsx

import { Avatar, AvatarGroup, Badge, Button, Card, Col, Container, Grid3, PageTitle, Progress, Row, Section, Text, Title } from "@vaneui/ui";
const projects = [
{ name: "Website relaunch", text: "New pages, pricing and the docs search.", done: 64, status: "On track", team: ["Ana Diaz", "Lee Park", "Mia Chen"] },
{ name: "Mobile app", text: "Sign-in, offline tasks and push alerts.", done: 38, status: "At risk", team: ["Sam Ortiz", "Lee Park"] },
{ name: "Q1 planning", text: "Goals, budgets and the hiring plan.", done: 12, status: "On track", team: ["Ana Diaz", "Mia Chen"] },
];
/**
* The same page while it loads: `skeleton` on the section turns everything inside into placeholders of
* the same size, so nothing moves when the data arrives. The status line tells screen readers to wait.
*/
export function ProjectsLoading({ loading = true }: { loading?: boolean }) {
return (
<Section>
<Text srOnly role="status">{loading ? "Loading projects" : ""}</Text>
<Container itemsStretch skeleton={loading}>
<Col lg>
<Row justifyBetween flexWrap>
<PageTitle>Projects</PageTitle>
<Button filled>New project</Button>
</Row>
<Grid3>
{projects.map((p) => (
<Card key={p.name}>
<Row justifyBetween itemsStart>
<Title tag="h2">{p.name}</Title>
<Badge success={p.status === "On track"} warning={p.status === "At risk"}>{p.status}</Badge>
</Row>
<Text secondary>{p.text}</Text>
<Progress value={p.done} aria-label={`${p.name} progress`} />
<Row justifyBetween>
<AvatarGroup sm aria-label="Team">
{p.team.map((n) => <Avatar key={n} name={n} />)}
</AvatarGroup>
<Text sm secondary className="tabular-nums">{p.done}% done</Text>
</Row>
</Card>
))}
</Grid3>
</Col>
</Container>
</Section>
);
}

How it adapts

  • Every width: the placeholders take the size of the real content, so nothing moves when it loads.
  • Below 1024px: two cards per row, then one below 768px.
  • A hidden status line tells screen readers that the projects are loading.

How these props work is in responsive page sections without breakpoint classes.

Adapt it with your coding agent

Add the VaneUI MCP server, and your agent reads the component docs and prop tables while it changes the block: the copy, the sample data or the layout.

$ claude mcp add vaneui -- npx -y @vaneui/mcp

Setup for other editors is in the AI assistants guide.