dolfindevelopers

Async states

ComponentFoundationsSDK + UI

LoadingState, EmptyState, ErrorState and InlineError for every data-owning view. ErrorState (no data) and InlineError (data still shown) turn a DolfinError into one readable sentence and offer a retry.

Component: A piece you place inside your own screens: a table, a form, a card or a dialog. You decide the layout around it. Pages vs components

Choose your integration

Works with Dolfin’s SDK context, with appearance and behaviour you can customise. Requires DolfinProvider.

Loading preview…

Installation

Needs the Dolfin registry token. The CLI copies the source into your app.

Terminal
bunx --bun shadcn@4.23.0 add @dolfin/base-states

Also installs: ui-base-states.

Usage

screen.tsx
import { LoadingState } from "@/components/dolfin/base/states";

// Place it anywhere inside your <DolfinProvider>.
<LoadingState />

Renders inside DolfinProvider (set it up once). It renders the data you pass as props.

API reference

PropTypeDescription
labelstringWhat is loading ("Loading bills..."); defaults to a generic label.
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
base.statescore.errors

Or edit the installed file directly: it is your code. See theming for colours and fonts.

Hooks

The SDK hooks this component uses. Use them directly from @dolfinai/react to build your own version.

useMessages

Files

Written to your app by the install command:

  • components/dolfin/base/states.tsx 58 lines