Components/NoData

NoData

An empty state for a data source that returned no records.

VerifiedSince 0.3.4

Usage

Basic

Loading demo...

Best Practices

  • Use it when a data source loaded and returned no records; offline, access, loading, and no-match states have their own components.
  • Keep copy data-specific: "No invoices yet" says more than "Nothing here".
  • Offer an action only when the current user can actually create or import the data.
  • Use surface="card" in dashboards and table panels so the empty region matches the loaded container.

API Reference

Takes every TxEmptyState prop, event, and slot except variant, which is fixed to no-data.

Props

PropTypeDefaultDescription
titlestringpreset titleOverrides the preset title.
descriptionstringpreset descriptionWhy the data is empty, or how to add some.
iconTxIconSource | string | nullpreset illustrationReplaces the illustration; null hides the icon area.
iconSizenumbersize presetIcon size in px.
layout'vertical' | 'horizontal''vertical'Layout direction.
align'start' | 'center' | 'end''center'Content alignment.
size'small' | 'medium' | 'large''medium'Spacing and illustration size.
surface'plain' | 'card''plain'card adds a card border.
primaryActionEmptyStateAction-Generated primary action.
secondaryActionEmptyStateAction-Generated secondary action.
actionSizeTxButtonProps['size']'sm'Default size of the generated buttons.
loadingbooleanfalseShows a spinner when no custom icon is given.

Events

EventParamsDescription
primary-Fires when the generated primary action is clicked.
secondary-Fires when the generated secondary action is clicked.

Slots

SlotPropsDescription
icon-Replaces the illustration or icon.
title-Replaces the title.
description-Replaces the description.
actions-Replaces the generated primary and secondary buttons.

Types

EmptyStateAction

FieldTypeDefaultDescription
labelstringrequiredButton label.
typeTxButtonProps['type']-Semantic button type, such as primary.
variantTxButtonProps['variant']-Visual button variant.
sizeTxButtonProps['size']actionSizeSize of this button.
disabledbooleanfalseDisables the button.
iconstring-Button icon class.

Technologies

  • Source: packages/tuffex/packages/components/src/no-data/.
查看源码
packages/tuffex/packages/components/src/no-data/index.ts