Components/BlankSlate

BlankSlate

Large onboarding empty state for first-use screens and empty product areas.

VerifiedSince 0.3.4

Usage

BlankSlate

Loading demo...

Best Practices

  • Use it for first-use or onboarding states; use TxNoData for recurring empty query results.
  • Explain the value of the first action, not just the absence of content.
  • Keep the primary action singular and direct. Secondary actions should teach, import, or dismiss.
  • Avoid surface="card" on full-page blank slates unless the surrounding layout already uses card containment.

API Reference

Props

TxBlankSlate accepts every EmptyStateProps field except variant.

PropTypeDefaultDescription
titlestringpreset titleOnboarding headline.
descriptionstringpreset descriptionExplains why the first action matters.
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''large'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="blank-slate" to TxEmptyState.
  • Applies onboarding defaults: size="large", layout="vertical", and surface="plain".
  • Explicit size, layout, and surface props override those defaults.
  • Forwards icon, title, description, and actions slots unchanged to TxEmptyState.
  • Generated primary / secondary events come from the wrapped TxEmptyState action buttons.

Technologies

  • Reviewed against packages/tuffex/packages/components/src/blank-slate/src/TxBlankSlate.vue, types.ts, and blank-slate.test.ts.
  • Verified coverage: blank-slate.test.ts covers fixed variant="blank-slate", onboarding defaults, explicit layout overrides, named slot forwarding, and install registration.
  • Accessibility note: TxBlankSlate delegates semantics to TxEmptyState; keep first-action copy specific and avoid placing multiple competing calls to action in actions.
  • Component source: packages/tuffex/packages/components/src/blank-slate/src/TxBlankSlate.vue.
  • Types: packages/tuffex/packages/components/src/blank-slate/src/types.ts exports BlankSlateProps as Omit<EmptyStateProps, 'variant'>.
  • Coverage: packages/tuffex/packages/components/src/blank-slate/__tests__/blank-slate.test.ts verifies wrapper defaults, overrides, slot forwarding, and install registration.
    查看源码
    packages/tuffex/packages/components/src/blank-slate/index.ts