Skip to content

Empty

Placeholder for empty states.

Basic Usage

Display a simple empty state.

No Data

Basic Usage

Custom Image

Set image URL via image prop.

Custom Image

Custom Image

Custom Image

Image Size

Set image width and height via image-size prop.

Custom Image Size

Image Size

Custom Bottom Content

Add custom content at the bottom via default slot, such as action buttons.

No orders yet

Custom Bottom Content

Custom Image Slot

Use the #image slot to fully customize the image area.

📦

Custom image slot

Custom Image Slot

Custom Description

Use the #description slot to customize the description text area.

No results found, try modifying keywords

Custom Description

Use in Nuxt

The Empty component fully supports Nuxt 3/4 SSR rendering. The empty state image and description are correctly rendered on the server, ensuring a complete empty state prompt is presented on the first screen, enhancing user experience.

No Data

Use in Nuxt

SSR Notes:

  • ✅ Description text (description) and image (image) render correctly on first load
  • ✅ Built-in SVG illustration fully output on the server
  • ✅ Custom image size (image-size) takes effect on initial render
  • 💡 Dynamic data loading and state switching logic is completed after client-side activation

Nuxt Auto Import

After installing the @yh-ui/nuxt module, the YhEmpty component is auto-registered, no manual import needed.

API

Props

PropDescriptionTypeDefault
imageCustom image URLstring
image-sizeImage size in pixelsnumber100
descriptionDescription textstring'暂无数据'
iconCustom image componentstring | Component
theme-overridesTheme override variablesComponentThemeVars

Slots

Slot NameDescription
defaultCustom bottom content (e.g. action buttons)
imageCustom image area
descriptionCustom description text

Theme Variables

VariableDescriptionDefault
--yh-empty-paddingContainer padding40px 0
--yh-empty-description-colorDescription text colorvar(--yh-text-color-secondary, #909399)
--yh-empty-description-font-sizeDescription font size14px
--yh-empty-ellipse-colorDefault illustration ellipse color#f5f5f7
--yh-empty-image-fillDefault illustration primary fill color#aeb8c2
--yh-empty-image-fill2Default illustration secondary fill color#f5f5f7
--yh-empty-plane-bgDefault illustration plane background#f5f5f7
--yh-empty-comment-fillDefault illustration comment fill color#dce0e6

Released under the MIT License.