Skip to content
Latestv1.0.63

Empty ​

Placeholder for empty states.

Basic Usage ​

Display a simple empty state.

Basic Usage

Custom Image ​

Set image URL via image prop.

Custom Image

Image Size ​

Set image width and height via image-size prop.

Image Size

Custom Bottom Content ​

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

Custom Bottom Content

Custom Image Slot ​

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

Custom Image Slot

Custom Description ​

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

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.

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

Events ​

This component does not expose component events.

Expose ​

This component does not expose public instance methods or properties.

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

Type Exports ​

NameDescription
YhEmptyPropsProps type for YhEmpty
YhEmptySlotsSlots type for YhEmpty
YhEmptyInstancePublic instance type for YhEmpty

Released under the MIT License.