Components/ErrorState

ErrorState

A state view shown when loading or an operation fails.

VerifiedSince 0.3.4

Usage

Basic

Loading demo...

Custom Copy

title and description override the preset copy; surface="card" adds a card surface.

Loading demo...

Dashboard Recovery States

Shares one data container with the loading and empty states.

Loading demo...

Best Practices

  • Name what failed in title, such as "Rules failed to load", not "Something went wrong".
  • Always offer a way out: retry, go back, open logs, or contact support.
  • Use surface="card" when the error replaces a data panel; keep plain inside an existing card.
  • Keep technical detail in logs or expandable diagnostics; the description tells users what to do next.
  • Use the actions slot only when the generated buttons cannot express the recovery flow.

API Reference

Takes every TxEmptyState prop, event, and slot except variant, which is fixed to error.

Props

PropTypeDefaultDescription
titlestring'Something went wrong'Error title; name the failed object or operation.
descriptionstring'Please try again later.'Supporting text and recovery advice.
iconTxIconSource | string | nullvariant defaultReplaces the built-in error illustration; null hides the icon area.
iconSizenumberderived from sizeIcon size; resolves from size to 28 / 36 / 44 when unset.
layout'vertical' | 'horizontal''vertical'Layout direction.
align'start' | 'center' | 'end''center'Content alignment.
size'small' | 'medium' | 'large''medium'Size tier.
surface'plain' | 'card''plain'Surface style.
primaryActionEmptyStateAction-Primary recovery action.
secondaryActionEmptyStateAction-Secondary action.
actionSizeTxButtonProps['size']'sm'Size of the generated buttons.
loadingbooleanfalseWithout an icon prop or slot, swaps the illustration for a TxSpinner; buttons are unaffected.

Events

EventParamsDescription
primary-Fires when the generated primary button is clicked; the host implements the retry.
secondary-Fires when the generated secondary button is clicked.

Slots

SlotPropsDescription
icon-Replaces the built-in error illustration.
title-Replaces the title.
description-Replaces the description.
actions-Replaces the generated primary and secondary buttons.

Technologies

  • Source: packages/tuffex/packages/components/src/error-state/; TxEmptyState draws the illustration.
查看源码
packages/tuffex/packages/components/src/error-state/index.ts