2.29.0
Empty states appear when content is missing or unavailable, providing insight on what has happened and how to proceed.
Empty states can be configured in a variety of ways depending on the situation and context. Implementing teams are encouraged to use the particular set of elements which best serve their use case.
Name
|
Required
|
Description
|
---|---|---|
Title |
Yes |
Briefly summarizes what went wrong (or right). |
Message |
Yes |
Provides additional context and offers guidance on next steps. |
Icon |
No |
Supplements the empty state message. |
List |
No |
Lists out criteria or additional options. |
Custom Action |
No |
Displays Buttons that allow a user to take an action as a result of the empty state. |
<mds-empty-state title="You Haven’t Created Any Reports Yet" message="Reports can be generated from Clients & Accounts, Billing, or Batch Schedules."></mds-empty-state>
Include a Button to provide users with a follow up action to resolve an empty state.
<mds-empty-state title="You Don’t Have Any Alerts Yet" message="You’ll find the history of your alerts here once a change occurs. If you haven’t set up alerts, add them now.">
<mds-button slot="mds-empty-state-actions" size="medium" variation="primary">Add Alerts</mds-button>
</mds-empty-state>
Use an icon to add meaning or to create a moment of delight.
<mds-empty-state title="Your Data Looks Great" message="We found no issues today.">
<img slot="mds-empty-state-icon" src="/images/components/empty-state/check-circle.svg" role="presentation">
</mds-empty-state>
Use a list to add structure to the empty state’s content, for example, specific criteria for a search query.
<mds-empty-state title="No Results" message="Try adjusting your search query." list='["Try removing filters.", "Try different keywords."]' size="medium">
</mds-empty-state>
Sizing affects text size and internal padding. The default size is medium and you can use props to make the empty state smaller or larger.
<mds-empty-state size="small" title="Empty State Title" message="This is a supporting message, further adding context and offering guidance on next steps." list='["List item 1", "List item 2"]'>
<img slot="mds-empty-state-icon" src="/images/components/empty-state/happy-face-70.svg" role="presentation">
<mds-button slot="mds-empty-state-actions" size="small" variation="secondary">Take Action</mds-button>
</mds-empty-state>
Center empty states horizontally and vertically within their container.
70x70px
85x85px
100x100px
When setting props as attributes on a custom HTML element, use kebab-case
instead of camelCase
.
Prop
|
Type
|
Validation
|
Default
|
Description
|
---|---|---|---|---|
|
String |
— |
— |
A space-separated list of class names that will be appended to the default |
|
Array |
— |
— |
Sets list content of the empty state. |
|
String |
Required |
— |
Sets the message text for the empty state. |
|
String |
One of: |
|
Alters the size of the empty state. |
|
String |
Required |
— |
Sets the title text for the empty state. |
Pass text in between the <mds-empty-state></mds-empty-state>
tags to set the title content. This can be overridden with the title
prop.
Slot Name
|
Description
|
---|---|
|
Displays an icon image within the empty state. |
|
Displays Buttons. |
Setting message
and size
via props. Using the default slot for title
content and named slots for an icon and action button:
<mds-empty-state size="large" message="This is an example message.">
Example Title Text
<img slot="mds-empty-state-icon" src="path/to/image.svg">
<mds-button slot="mds-emptty-state-actions" size="large">Take Action</mds-button>
</mds-empty-state>
role="presentation"
to purely decorational empty state icons to ensure they are ignored by screen readers.