UIEmpty
UIEmpty
UIEmpty is a placeholder component that provides visual feedback when no data is available or when a container has no content. It helps improve the user experience by communicating the empty state with optional illustrations, messages, and actions.
<template> <UIEmpty description="No data available" image="/path/to/empty-image.svg" > <template #footer> <UIButton type="primary">Create New</UIButton> </template> </UIEmpty></template>Props
description(string): The text description explaining the empty stateimage(string): URL of the image to display as the empty state illustrationimageStyle(object): Custom styling for the empty state imageimageSize(number): Size of the image in pixels
Slots
image: Custom image or icon contentdescription: Custom description contentfooter: Additional content like action buttonsdefault: Custom content that replaces the default empty layout
Usage Examples
- Basic Empty State:
<template> <UIEmpty description="No data available" /></template>- Custom Image:
<template> <UIEmpty description="Your inbox is empty" image="/assets/empty-inbox.svg" :imageSize="120" /></template>- With Action Button:
<template> <UIEmpty description="No tasks found"> <template #footer> <UIButton type="primary">Add Task</UIButton> </template> </UIEmpty></template>- Custom Description with HTML:
<template> <UIEmpty> <template #description> <span>No results match your <strong>search criteria</strong>.</span> </template> </UIEmpty></template>- Fully Customized Empty State:
<template> <UIEmpty> <template #image> <UiIcon name="inbox" :size="64" /> </template> <template #description> <h3>No Messages</h3> <p>You have no new messages in your inbox.</p> </template> <template #footer> <UIButton>Refresh</UIButton> <UIButton type="primary">Compose</UIButton> </template> </UIEmpty></template>Best Practices
-
Content Guidelines:
- Use clear, concise language
- Explain why the content is empty
- Suggest an action when appropriate
- Match messaging to the application context
-
Visual Design:
- Use illustrations that match the UI style
- Ensure the empty state is visible but not overwhelming
- Consider using branded imagery
- Maintain proper spacing and alignment
-
User Experience:
- Provide guidance on how to add content
- Don’t hide essential UI functionality in empty states
- Consider first-time user experiences
- Make empty states helpful rather than just informative
-
Responsiveness:
- Adjust empty state sizing for different viewports
- Ensure legibility on small screens
- Consider simplified versions for mobile
- Test across different device sizes