Components/NoData

NoData

Shortcut empty-state component for empty datasets, tables, charts, and metrics panels.

VerifiedSince 0.3.4

Usage

NoData

Loading demo...

Best Practices

  • Use it when a data source is valid and returned zero records; use TxOfflineState or TxPermissionState for transport and access failures.
  • Keep copy data-specific: “No invoices yet” is more useful than “Nothing here”.
  • Offer a creation or import action only when the current user can actually populate the dataset.
  • Use surface="card" inside dashboards and table panels so the empty region occupies the same container as loaded data.

API Reference

Props

TxNoData accepts every EmptyStateProps field except variant.

PropTypeDefaultDescription
titlestringpreset titleOverrides the no-data title.
descriptionstringpreset descriptionExplains why the dataset is empty or how to populate it.
iconTxIconSource | string | nullpreset illustrationCustom icon source/class, or null to hide the icon area.
iconSizenumbersize presetCustom icon size in pixels.
layout'vertical' | 'horizontal''vertical'Empty-state layout.
align'start' | 'center' | 'end''center'Alignment within the wrapper.
size'small' | 'medium' | 'large''medium'Density and illustration scale.
surface'plain' | 'card''plain'Adds card containment when needed.
primaryActionEmptyStateAction-Generated primary action.
secondaryActionEmptyStateAction-Generated secondary action.
actionSizeTxButtonProps['size']'small'Default generated action size.
loadingbooleanfalseUses spinner when no custom icon is supplied.

EmptyStateAction

FieldTypeDefaultDescription
labelstringrequiredButton label.
typeTxButtonProps['type']-Button semantic type, for example primary.
variantTxButtonProps['variant']-Button visual variant.
sizeTxButtonProps['size']actionSizePer-button size override.
disabledbooleanfalseDisables the generated button.
iconstring-Button icon class.

Events

EventParamsDescription
primary-Forwarded from the generated primary action.
secondary-Forwarded from the generated secondary action.

Slots

SlotPropsDescription
icon-Replaces the preset illustration or custom icon.
title-Replaces resolved title content.
description-Replaces resolved description content.
actions-Replaces generated primary/secondary action buttons.

Overview

  • Always forwards variant="no-data" to TxEmptyState.
  • Does not rewrite explicit title, description, surface, layout, align, size, icon, or action props.
  • Forwards icon, title, description, and actions slots unchanged to TxEmptyState.
  • Generated primary / secondary events come from the wrapped TxEmptyState action buttons.

Technologies

  • Wrapper contract: TxNoData is a thin TxEmptyState wrapper that always supplies variant="no-data"; every other EmptyStateProps field is forwarded unchanged.
  • State choice: Use this only for valid, loaded datasets with zero records. Connectivity, access, loading, and filtered-result states have dedicated wrappers so copy and recovery actions stay precise.
  • Verified coverage: no-data.test.ts covers forced variant forwarding, explicit props/actions, named slots, and install registration; base rendering and action events are inherited from TxEmptyState.
  • Component source: packages/tuffex/packages/components/src/no-data/src/TxNoData.vue.
  • Base source: packages/tuffex/packages/components/src/empty-state/src/TxEmptyState.vue.
  • Types: packages/tuffex/packages/components/src/no-data/src/types.ts exports NoDataProps = Omit<EmptyStateProps, 'variant'>.
  • Coverage: packages/tuffex/packages/components/src/no-data/__tests__/no-data.test.ts verifies variant locking, prop forwarding, slot forwarding, and install behavior.
查看源码
packages/tuffex/packages/components/src/no-data/index.ts