docs/documentation/patterns/empty-states.mdx
Empty states can occur when:
Possible elements of an empty state include:
Most empty states in Segment fall in one of four categories:
Segment often shows users tables with large data sets. When the data in these tables is either unavailable or nonexistent, maintain the table header in the empty state to provide additional context and set expectations. For example, if a table of tracked events isn’t populated yet, the empty state within the table shows the user what event data event will eventually populate.
<Table maxWidth={1152} width="100%">
<Table.Head>
<Table.TextHeaderCell>Event Name</Table.TextHeaderCell>
<Table.TextHeaderCell>Last Seen</Table.TextHeaderCell>
<Table.TextHeaderCell>Allowed</Table.TextHeaderCell>
<Table.TextHeaderCell>Blocked</Table.TextHeaderCell>
</Table.Head>
<Table.Body height="auto">
<EmptyState
background="light"
title="No tracked events for this Source"
orientation="horizontal"
icon={<SearchIcon color="#C1C4D6" />}
iconBgColor="#EDEFF5"
description="Events appear when the Source starts sending data to Segment about your users and their activity."
anchorCta={
<EmptyState.LinkButton href="https://segment.com/docs/" target="_blank">
Learn how to start tracking events
</EmptyState.LinkButton>
}
/>
</Table.Body>
</Table>
Empty states for content outside of a table include a background color to create variation on screens where there are multiple empty states or when an entire screen is blocked. For example, if an entire screen is blocked because a user doesn’t have the necessary permissions, a background is added to the empty state to create contrast and containment.
<EmptyState
background="dark"
title="You need permission for these sources"
orientation="horizontal"
icon={<LockIcon color="#EBAC91" />}
iconBgColor="#F8E3DA"
description="To see these sources, request access."
primaryCta={<EmptyState.PrimaryButton>Request access</EmptyState.PrimaryButton>}
/>
When design real estate is limited, consider using a small empty state.
<Popover
content={
<Pane width={450} height="auto">
<EmptyState
background="light"
title="You need permission for these sources"
orientation="vertical"
icon={<LockIcon color="#EBAC91" />}
iconBgColor="#F8E3DA"
description="To see these sources, request access."
primaryCta={<EmptyState.PrimaryButton appearance="primary">Request access</EmptyState.PrimaryButton>}
/>
</Pane>
}
>
<Button>Show Empty State</Button>
</Popover>
The smallest acceptable empty state uses only a visual and headline. Minimal empty states typically occur in small components, like drop downs or side sheets within tables.
<Popover
content={
<Pane width={300} height="auto">
<EmptyState
background="light"
title="No event selected"
orientation="vertical"
icon={<HandUpIcon color="#C1C4D6" />}
iconBgColor="#EDEFF5"
/>
</Pane>
}
>
<Button>Show Empty State</Button>
</Popover>
Empty state content should explain what information or data isn’t being showed, and how to change the empty state to a populated state.
Limit headline text to one line. Since users typically skim online content, the headline should contain the most important information.
Limit body copy to two lines. Use the body copy to introduce additional information about what the user can do with this UI element.
Buttons and link text should set expectations for the user.
Tone should be educational and plain-spoken.
<RuleLayout> <RuleCard type="Do" description="Use an educational and plain-spoken tone." image="/empty-state-tone-do.png" imageAlt="empty-state-tone-do" /> <RuleCard type="Don't" description="Use excessive emotion or exceed 1 line for headline and 2 lines for body." image="/empty-state-tone-dont.png" imageAlt="empty-state-tone-dont" /> </RuleLayout>