Components/NoSelection

NoSelection

Shortcut empty-state component for unselected detail panels, based on TxEmptyState with variant no-selection.

VerifiedSince 0.3.4

Usage

NoSelection

Loading demo...

Best Practices

  • Use it when the current pane is valid but depends on a user selection; use TxNoData when the dataset itself is empty.
  • Pair it with visible list/table selection affordances so the next step is discoverable.
  • Use surface="card" inside split panes where the empty region needs boundaries.
  • Keep action labels specific, such as “Create item” or “Open list”, not “OK”.

API Reference

Props

TxNoSelection accepts every EmptyStateProps field except variant.

PropTypeDefaultDescription
titlestringpreset titleOverrides the no-selection title.
descriptionstringpreset descriptionSupporting text for what to select next.
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.

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-selection" to TxEmptyState.
  • Does not override 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: TxNoSelection always supplies variant="no-selection" to TxEmptyState and forwards all non-variant props and named slots.
  • State choice: Use it for empty detail panes or inspectors waiting on a user selection; do not use it for empty datasets or filtered searches.
  • Verified coverage: no-selection.test.ts covers variant locking, action prop forwarding, named slot forwarding, and install registration.
  • Component source: packages/tuffex/packages/components/src/no-selection/src/TxNoSelection.vue.
  • Base source: packages/tuffex/packages/components/src/empty-state/src/TxEmptyState.vue.
  • Types: packages/tuffex/packages/components/src/no-selection/src/types.ts exports NoSelectionProps = Omit<EmptyStateProps, 'variant'>.
  • Coverage: packages/tuffex/packages/components/src/no-selection/__tests__/no-selection.test.ts verifies wrapper forwarding and install behavior.
查看源码
packages/tuffex/packages/components/src/no-selection/index.ts