Empty
Displays an empty state.
You haven't created any projects yet. Get started by creating your first project.
Installation
Install the following dependencies:
Set up the token layer and the StyleX compiler, if you have not already. See
Installation, and paste states.ts and
breakpoints.stylex.ts from the same page. The icon tile comes from
states.ts. Empty also needs interop.css, which sizes the icon.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
Usage
Composition
EmptyHeader holds the media, title and description close together.
EmptyContent follows a wider gap below it.
Avatar
Leave EmptyMedia on its default variant to show an avatar or an image of
your own instead of the icon tile.
This user is currently offline. You can leave a message to notify them or try again later.
In a table
Inside a surface that already has a fill, such as a table's body, remove the
tray with xstyle.
| Endpoint | Events | Success rate |
|---|---|---|
No endpoints Add an endpoint to start receiving events. | ||
API reference
Pass render to replace a part's element or compose it with another component.
Every part renders through Base UI's
useRender, and takes xstyle,
className and inline style alongside every attribute of its element.
EmptyDescription renders a p; every other part renders a div.
Empty
A centred column on a tray. It grows to fill a flex parent, and its padding
widens from 1.5rem to 3rem at the md breakpoint.
EmptyHeader
A column with a 0.25rem gap, at most 24rem wide.
EmptyMedia
| Prop | Type | Default |
|---|---|---|
variant | "default" | "icon" | "default" |
icon puts the glyph on a 2.5rem tile and sizes it to 1.25rem. default
centres whatever it holds.
EmptyTitle
Weight 500 at the body size.
EmptyDescription
Muted text at the body size.
EmptyContent
A column with a 1rem gap for actions or anything else, at most 24rem wide.
emptyStyles
The style maps behind the component. Spread them onto any element.
| Key | What it is |
|---|---|
base | The tray and its centred column |
header | The media, title and description column |
media | The media's box |
mediaVariants | default, and icon with the shared iconTile |
title | The title's type |
description | The muted description |
content | The column below the header |
Data attributes
| Attribute | On | Effect |
|---|---|---|
data-slot="empty" | the root | Targets the root from a parent |
data-slot="empty-header" | the header | Targets the header from a parent |
data-slot="empty-media" | the media | Targets the media from a parent |
data-variant | the media | Reflects the media's variant prop |
data-slot="empty-title" | the title | Targets the title from a parent |
data-slot="empty-description" | the description | Targets the description from a parent |
data-slot="empty-content" | the content | Targets the content from a parent |
CSS variables
| Variable | On | Effect |
|---|---|---|
--carbon-icon-size | the media | The icon's size, read by interop.css. 20px on icon |