X Enterprises
nuxt-x-app

State

Standardized empty, error, and loading state components for consistent feedback across the application.

State

The State category provides three building-block components for communicating asynchronous UI states: empty data sets, error conditions, and loading progress. Using these consistently instead of ad-hoc inline markup keeps feedback patterns uniform throughout the application.

Components

<XAStateEmpty />

Displays a centered illustration-style empty state with an icon, title, optional description, and an optional action slot (e.g. a CTA button). Uses role="status" for accessibility.

<XAStateEmpty
  icon="i-lucide-folder-open"
  title="No documents found"
  description="Create a document to get started."
>
  <template #action>
    <UButton @click="createDocument">New Document</UButton>
  </template>
</XAStateEmpty>

Props

PropTypeDefaultDescription
iconString'i-lucide-inbox'Lucide icon name shown inside the icon circle.
titleString'No data'Primary heading text.
descriptionString''Optional supporting text below the title.

Slots

SlotDescription
actionOptional CTA area rendered below the description.

<XAStateError />

Displays a centered error state with a red triangle alert icon, title, optional description, and a "Try again" button when the error is retryable. Uses role="alert" for accessibility.

<XAStateError
  title="Failed to load users"
  description="Check your connection and try again."
  :retryable="true"
  @retry="fetchUsers"
/>

Props

PropTypeDefaultDescription
titleString'Something went wrong'Error heading text.
descriptionString''Optional detail text below the title.
retryableBooleantrueWhen true, renders a "Try again" button that emits retry.

Events

EventDescription
retryEmitted when the user clicks the retry button.

<XAStateLoading />

A multi-variant loading component that adapts its skeleton or spinner to the type of content being loaded. All variants include role="status" and aria-live="polite".

<!-- Default spinner with message -->
<XAStateLoading message="Loading users..." size="md" />

<!-- Row skeletons for list content -->
<XAStateLoading variant="rows" :rows="5" />

<!-- Table skeleton -->
<XAStateLoading variant="table" :rows="8" />

<!-- Form skeleton -->
<XAStateLoading variant="form" />

Props

PropTypeDefaultDescription
variantString'spinner'Loading style — 'spinner', 'rows', 'card', 'form', or 'table'.
rowsNumber3Number of skeleton rows for rows and table variants.
messageString''Optional message shown below the spinner (spinner variant only).
sizeString'md'Spinner size — affects spinner dimensions and message font size.

AI Context

category: State
package: "@xenterprises/nuxt-x-app"
use-when: >
  Use XAStateEmpty when a data list or section has no items to show. Use XAStateError
  when a data fetch or action fails, passing retryable=true to let users retry. Use
  XAStateLoading while async data is in flight, choosing the variant that matches
  the shape of the content being loaded (rows for lists, table for tables, form for
  forms, spinner for generic waits). These three components cover all standard async
  lifecycle states and should be preferred over inline ad-hoc markup.
Copyright © 2026