Skip to content
Eskais UI

Feedback

States

Screen states that never lie: LoadingState (spinner or skeleton, busy, label for screen readers), ErrorState (alert, retry, collapsible details) and DataState, which picks loading, error, empty or your content from a status and never shows empty while pending or after an error.

Example

Projects
Your team's deployments.
  • Apollo
    Ready
    Deployed 2 hours ago
  • Gemini
    Building
    Building #1482
  • Mercury
    Failed
    Failed 3 days ago

Installation

npx shadcn@latest add @eskais/states
npm packagesclass-variance-authority@0.7.1lucide-react

Usage

Import
import { LoadingState } from "@/components/ui/loading-state"import { ErrorState } from "@/components/ui/error-state"import { DataState } from "@/components/ui/data-state"import { useLastSuccess } from "@/components/ui/use-last-success"

API reference

LoadingState

PropTypeDefault
labelrequiredRead by screen readers, never shown.string–
variant"spinner" | "skeleton""spinner"
rowsPlaceholder lines, with `variant="skeleton"`.number3
sizeEmptySize"panel"

Also takes <div> attributes except children.

ErrorState

Takes Omit<ComponentProps<"div">, "title"> &.

DataState

PropTypeDefault
statusrequired"pending" | "error" | "success"–
datarequiredThe result. Read only while `status` is success: data passed while pending is not shown.T | undefined–
placeholderDataShown as content, marked busy, while pending before the first success, like cached or initial data.T–
errorE–
isEmptyWhether successful data counts as empty. By default an empty array, `null` or `undefined` does.(data: T) => boolean–
loadingReplaces the default LoadingState.ReactNode–
keepPreviousDataKeeps showing the data of the last success while `status` is pending again, marked busy. Default true.boolean–
fetchingA refetch in the background while `status` stays success, as some data libraries report it.boolean–
labelsPartial<DataStateLabels> | { errorTitle: ReactNode; retry: ReactNode } | { errorTitle: ReactNode }–
sizeEmptySize–
classNamestring–
childrenrequired(data: T) => ReactNode–
renderError(error: E, retry: (() => unknown) | undefined) => ReactNode | undefined–
onRetry() => unknown | undefined–

Also takes <div> attributes except children, className.

Other exports

useLastSuccesstype LoadingStatePropstype ErrorStatePropstype DataStateLabelstype DataStatePropstype DataStatus

Accessibility

  • Never empty while pending or after an error; a refetch keeps the last data with aria-busy.
  • ErrorState is an alert with a retry button and collapsible details.

Agent actions

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.