UI Toolbox logoUI Toolbox

EmptyState

An EmptyState is the content of a list or a panel that has nothing to show: an icon, a title, a message and action buttons, in the center. It tells the user why the place is empty and what to do next.

An empty state with the title No saves yet, a message and a New game button

How to show an empty state for a list:

<ui:ListView name="saves" />
<tb:EmptyState name="noSaves" title="No saves yet" message="Start a game to make the first save.">
    <ui:Button text="New game" name="newGame" />
</tb:EmptyState>
void refresh()
{
    var empty = saves.Count == 0;
    root.Q("noSaves").style.display = empty ? DisplayStyle.Flex : DisplayStyle.None;
    root.Q("saves").style.display = empty ? DisplayStyle.None : DisplayStyle.Flex;
}
Member Description
Icon (icon) The picture above the title, 48 px: a texture, a sprite, a render texture or a vector image. No picture by default. The USS tint is the muted text color, so a white image works best.
Title (title) The bold line. An empty title shows no line.
Message (message) The text under the title. Rich text tags work. An empty message shows no line.

Tips:

Styling

Class Element
tb-empty-state The control. It grows, and puts its content in the center with --tb-spacing-lg padding.
tb-empty-state__icon The picture, 48 px, with a --tb-color-text-muted tint. Hidden without an image.
tb-empty-state__title The bold title in the large font size, 320 px wide at most.
tb-empty-state__message The message in --tb-color-text-muted, 320 px wide at most.
tb-empty-state__actions The centered row of the child elements.
.tb-empty-state__icon { width: 96px; height: 96px; -unity-background-image-tint-color: var(--tb-color-accent); }