Components/LoadingState

LoadingState

Shortcut empty-state component for loading placeholders, based on TxEmptyState with `variant="loading"`.

VerifiedSince 0.3.4

Usage

LoadingState

Loading demo...

Best Practices

  • Use TxLoadingState for full-panel first loads where the final empty/error/success panel will occupy the same area.
  • Keep copy specific: name the resource being fetched, for example “Loading rules” or “Syncing plugins”.
  • Prefer surface="card" when the surrounding layout would otherwise collapse during loading.
  • Pass loading only when you want a spinner instead of the preset loading illustration.
  • Use actions sparingly. A cancel or retry action is useful only when the underlying request can actually be interrupted or restarted.

API Reference

TxLoadingState inherits TxEmptyState props, slots, and events except variant; the wrapper always supplies variant="loading".

Props

PropTypeDefaultDescription
titlestringLoadingOverrides the preset loading title.
descriptionstringPlease wait a moment.Overrides the loading supporting text.
iconTxIconSource | string | null-Replaces the loading illustration, or null to hide the icon area (no effect while loading is true — the spinner still renders).
iconSizenumber-Sets custom icon/spinner size in pixels.
layout'vertical' | 'horizontal''vertical'Controls icon/content direction.
align'start' | 'center' | 'end''center'Aligns icon, copy, and actions.
size'small' | 'medium' | 'large''medium'Adjusts spacing, text scale, and illustration size.
surface'plain' | 'card''plain'Adds bordered containment for panels that need reserved space.
primaryActionEmptyStateAction-Renders the primary action and emits primary.
secondaryActionEmptyStateAction-Renders the secondary action before the primary action and emits secondary.
actionSizeTxButtonProps['size']'small'Default size for generated action buttons.
loadingbooleanfalseShows a spinner when no custom icon slot or icon prop is provided.

Slots

NameDescription
iconReplaces the preset loading illustration or spinner.
titleReplaces the resolved title content.
descriptionReplaces the resolved description content.
actionsReplaces generated primary and secondary action buttons.

Events

EventDescription
primaryEmitted when the generated primary action button is clicked.
secondaryEmitted when the generated secondary action button is clicked.

Dashboard Recovery States

Loading states should reserve the same container size as empty/error states to avoid layout jumps after data resolves.

Dashboard recovery states

A loading state sharing the same container with empty/error states for dashboard data panels.

Loading demo...

Overview

  • TxLoadingState always forwards variant="loading" to TxEmptyState.
  • The wrapper does not rewrite title, description, loading, or action config; explicit props are forwarded as-is.
  • icon, title, description, and actions slots are forwarded unchanged to TxEmptyState.

Technologies

  • Component source: packages/tuffex/packages/components/src/loading-state/src/TxLoadingState.vue.
  • Base source: packages/tuffex/packages/components/src/empty-state/src/TxEmptyState.vue.
  • Types: packages/tuffex/packages/components/src/loading-state/src/types.ts exports LoadingStateProps = Omit<EmptyStateProps, 'variant'>.
  • Verified coverage: packages/tuffex/packages/components/src/loading-state/__tests__/loading-state.test.ts verifies loading variant locking, explicit prop/action forwarding, named slots, and install behavior.
查看源码
packages/tuffex/packages/components/src/loading-state/index.ts
  • Wrapper contract: TxLoadingState locks variant="loading"; pass loading only when the base spinner illustration should replace the default loading illustration.
  • Recommendation: Use TxLoadingState for full-panel first-load states; use TxSpinner or TxProgressBar loading for inline/local waiting.
  • Accessibility: Loading copy should name what is being loaded, for example “Loading rules”, not only “Loading”.