NoSelection
Shortcut empty-state component for unselected detail panels, based on TxEmptyState with variant no-selection.
Usage
NoSelection
Loading demo...
Best Practices
- Use it when the current pane is valid but depends on a user selection; use
TxNoDatawhen 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.
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | preset title | Overrides the no-selection title. |
description | string | preset description | Supporting text for what to select next. |
icon | TxIconSource | string | null | preset illustration | Custom icon source/class, or null to hide the icon area. |
iconSize | number | size preset | Custom 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. |
primaryAction | EmptyStateAction | - | Generated primary action. |
secondaryAction | EmptyStateAction | - | Generated secondary action. |
actionSize | TxButtonProps['size'] | 'small' | Default generated action size. |
loading | boolean | false | Uses spinner when no custom icon is supplied. |
Events
| Event | Params | Description |
|---|---|---|
primary | - | Forwarded from the generated primary action. |
secondary | - | Forwarded from the generated secondary action. |
Slots
| Slot | Props | Description |
|---|---|---|
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"toTxEmptyState. - Does not override explicit
title,description,surface,layout,align,size,icon, or action props. - Forwards
icon,title,description, andactionsslots unchanged toTxEmptyState. - Generated
primary/secondaryevents come from the wrappedTxEmptyStateaction buttons.
Technologies
- Wrapper contract:
TxNoSelectionalways suppliesvariant="no-selection"toTxEmptyStateand 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.tscovers 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.tsexportsNoSelectionProps = Omit<EmptyStateProps, 'variant'>. - Coverage:
packages/tuffex/packages/components/src/no-selection/__tests__/no-selection.test.tsverifies wrapper forwarding and install behavior.
查看源码
packages/tuffex/packages/components/src/no-selection/index.ts