FSAI Design System
Components

Error State

Compound primitive for centered error messaging, recovery actions, and route-level failure surfaces.

Overview

ErrorState is the shared compound primitive for blocked or failed surfaces that need a clear title, explanation, and recovery action.

It is the low-level UI layer behind several broader platform patterns:

LayerRole
ErrorStateRaw visual primitive for composing an error surface manually
ErrorGuardRuntime wrapper that maps an error object to a preset ErrorState
Panel.ErrorGuardPanel-tuned ErrorGuard with centered drawer spacing
DataTable errorStateDataTable hook into ErrorGuard for collection-level failures

This page documents the primitive layer. See the error-handling patterns page for when to use ErrorGuard, Panel.ErrorGuard, and DataTable error recovery.

Basic Composition

import { ErrorState } from '@fsai/shared-ui';

<ErrorState className="h-full min-h-full justify-center px-6 py-12">
  <ErrorState.Icon />
  <ErrorState.Title>Something went wrong</ErrorState.Title>
  <ErrorState.Description>
    There was a problem loading this content.
  </ErrorState.Description>
  <ErrorState.Actions>
    <ErrorState.Action
      role="button"
      variant="primary"
      onClick={handleRetry}
    >
      Retry
    </ErrorState.Action>
  </ErrorState.Actions>
</ErrorState>

This is the standard full-surface composition used for route errors and feature-owned fallback screens.

Compound API

PartPurpose
ErrorStateRoot centered stack container
ErrorState.IconDecorative icon treatment with concentric background rings
ErrorState.TitlePrimary failure heading
ErrorState.DescriptionSupporting explanation text
ErrorState.ActionsHorizontal action row
ErrorState.ActionShared Button-based recovery action

Layout Patterns

ErrorState is intentionally minimal. The main layout control is className on the root.

Common layouts:

LayoutTypical classesNotes
Full page or routeh-full min-h-full justify-center px-6 py-12Centers the message in the available page shell
Panel bodymin-h-full justify-center px-6 py-12This is what Panel.ErrorGuard standardizes
Scrollable table/list regionmin-h-full flex-1 justify-start px-6 pt-32 pb-6Leaves space for toolbar and table chrome above
Compact message blockw-fullUseful when embedding only title and description in a custom layout

Icons And Actions

ErrorState.Icon defaults to WarningTriangle.

Override it when the failure meaning is more specific, such as:

  • SearchMagnifyingGlass for not-found states
  • LockLocked for auth or permission problems
  • InfoSquare for validation or request guidance

ErrorState.Action is just the shared Button API with sensible defaults:

  • variant="secondary" by default
  • size="md" by default
  • supports both role="button" and role="link"

That means route-level recovery can navigate:

<ErrorState.Action role="link" href={routes.BASE} variant="primary">
  Back Home
</ErrorState.Action>

Props

ErrorState

PropTypeDefaultDescription
childrenReactNodeRequired. Error state content tree.
classNamestringAdditional layout classes.
HTML div propsHTMLAttributes<HTMLDivElement>Passed through to the root container.

ErrorState.Icon

PropTypeDefaultDescription
iconIconName'WarningTriangle'Main error icon.
classNamestringAdditional wrapper classes.

ErrorState.Title

PropTypeDefaultDescription
childrenReactNodeRequired. Title content.
classNamestringAdditional title classes.

ErrorState.Description

PropTypeDefaultDescription
childrenReactNodeRequired. Description content.
classNamestringAdditional description classes.

ErrorState.Actions

PropTypeDefaultDescription
childrenReactNodeRequired. One or more actions.
classNamestringAdditional action-row classes.

ErrorState.Action

ErrorState.Action forwards shared ButtonProps.

Most common props:

PropTypeDefaultDescription
role'button' | 'link'Required. Chooses interaction mode.
variantButton variant'secondary'Visual emphasis for the action.
sizeButton size'md'Shared button sizing.
childrenReactNodeRequired. Action label.
onClick() => voidButton action handler.
hrefstringLink destination when role="link".

When Raw ErrorState Fits

Reach for raw composition when:

  • the screen already knows the failure copy and actions
  • the error surface is route-level or shell-level
  • there is no runtime error object to classify
  • the layout needs custom visual chrome around the error message

If you already have an error object and want shared presets like notFound, permissionDenied, or serverError, prefer ErrorGuard instead.

Brand Dashboard Usage

PatternPathNotes
Full-page fatal errorfsai/apps/brand-dashboard/src/pages/ErrorPage.tsxStandard route-level fallback with reload action.
404 pagefsai/apps/brand-dashboard/src/pages/NotFound/NotFound.tsxUses a more specific icon and navigation action.
Informational embedded messagefsai/apps/brand-dashboard/src/EmailActivity/EmailActivityDrawer.tsxExisting usage without icon or actions inside a custom empty-state wrapper.

Important Conventions

  • Prefer ErrorState for blocked or failed surfaces, not for ordinary empty content.
  • Keep actions recovery-oriented: retry, navigate, close, or go back.
  • Let the surrounding surface decide spacing. ErrorState should not hardcode page or panel sizing.
  • Use ErrorGuard when the feature has a real runtime error object and should benefit from shared preset handling.

Guidelines

  • Do use ErrorState for centered error messaging with clear next actions
  • Do override the icon when the failure meaning is more specific than a generic warning
  • Do use role="link" on actions when recovery is navigation
  • Don't use raw ErrorState where ErrorGuard or Panel.ErrorGuard already expresses the pattern better
  • Don't treat ErrorState as the default empty-state primitive for non-error content

On this page