Ant Design Svelte

Empty

Empty states, illustrations, creating the first record and general renderEmpty.

When to use

Empty explains a completed state with no entries: a new project, an empty list, or no search results. The message should prompt the next step - create a record, change the query, or reset the filter.

While the request is running, use Spin or Skeleton. Loading failure requires a reason and retry message; it does not mean the absence of data.

Illustration, description and action

Image selects an embedded illustration, URL or snippet. description specifies an explanation; without an explicit value, the current locale is used. children contains additional content, usually an action button.

Problem Opportunity Example
Show missing data defaults Basic option
Fit a fortune into a small area image="simple" Compact picture
Add your image and button image, description, children Net worth
Remove signature description={false} No text
Replace generic empty lists ConfigProvider.renderEmpty General composition

Built-in options are selected with the default/simple lines. The other string image is treated as a URL. Set the size of the illustration using styles.image, and not the style of the entire Empty. For a complex description, use a snippet with short text and relevant links.

Locale and general settings

ConfigProvider.locale.empty changes the default signature. Explicit description takes precedence; false hides the description completely. ConfigProvider.empty specifies the inherited illustration, class/style and semantic defaults.

RenderEmpty is a separate snippet of a common provider for empty content of supported components: Select, TreeSelect, Cascader, Transfer and Table. It does not replace the description of each randomly placed Empty. general example shows exactly the consuming components of this context.

Nested providers allow you to independently change the language and design of different areas. The Empty settings and the general renderEmpty function solve different problems: the first design the component, the second creates the contents of the empty result.

Availability and transition to data

The illustration is decorative and should not provide a single explanation. Communicate the meaning with a description, and the action with a native button or link with a clear name.

After the first entry is created, Empty disappears along with its button. Set the focus to the data area to be saved or the new record in advance. In applied example this is a table area; After clearing the list, focus returns to the input field.

classNames/styles support root, image, description and footer, an object or a callback from props. Svelte styles contains CSS strings. bind:nativeElement returns the root div after the mount. Empty does not have a separate set of component design tokens; it uses a common theme and semantic styles.

prefixCls specifies the full local CSS prefix Empty. The empty string and undefined inherit ConfigProvider.prefixCls with the -empty suffix, defaulting to ant-empty. Changing classes preserves the drawing, description and semantic styles; namespace CSS variables do not change. Example ConfigProvider shows common inheritance.

Examples

No data

Empty state

Inline artwork and caption from the current locale.

No tasks yet

Compact illustration

image="simple" is suitable for empty lists and small areas.

There are no documents in this folder yet
Create your first document to get started.

The document has not been created yet.

Picture, description and action

Illustration URL, size via styles.image, Snippet description and create button.

Select

TreeSelect

Cascader

Transfer

0 item Available
Data not found
0 item Selected
Data not found
Styles by object
Styles function
Created records: 0

Semantic DOM

The styles/classNames object and function style root, image, description and footer.

No description

description={false} leaves the illustration without a caption.

Russian

Нет данных

English

No data

Locale and Empty settings

Local ConfigProvider changes the language and inherited illustration independently of each other.

There is nothing here yet.
Participants: 0. Shown: 0. Actions: 0.

Participants and search

Add the first team member or see what the team sees when a search returns no results.

API

Verified against six ant.design 6.6.8 page themes and @woodger/antd public types. Full Props definitions belong to the package.

Topics of official examples
ThemeExample
BasicStandard empty state.
Choose imageBuilt-in compact illustration.
CustomizeURL, size, Snippet and action.
ConfigProviderTotal contents of five components.
Custom semantic dom stylingStyles object and function.
No descriptionExplicitly disable label.
Main parameters
PropertyDescriptionTypeDefault
prefixClsFull local CSS prefix for the root, image, and description of the Empty. The empty string and undefined inherit ConfigProvider.prefixCls; the default is ant-empty.stringConfigProvider + -empty
imagedefault, simple, URL or Snippet; false hides the illustration.EmptyImagedefault / context
descriptionText, number or Snippet; false hides the label.EmptyDescriptionfrom locale
childrenAdditional content, such as a create button.EmptyContent—
stylesCSS lines by semantic slots; object or function ({ props }).EmptySemantic—
classNamesClasses by semantic slots; object or function ({ props }).EmptySemantic—
nativeElementbind:nativeElement gives access to the root DOM element.HTMLDivElementafter mount
refbind:ref provides nativeElement; cleared when unmounted.EmptyRefafter mount

Built-in images

Instead of React constants Empty.PRESENTED_IMAGE_DEFAULT and Empty.PRESENTED_IMAGE_SIMPLE pass image="default" or image="simple". The remaining lines are considered URLs. Snippet allows you to insert your own illustration, false hides it.

ConfigProvider

empty specifies the image and decoration of the Empty instances inside the provider. renderEmpty(componentName) returns the contents of the empty area of ​​other components. A parameter of the component itself, for example Table.empty or Select.notFoundContent, takes precedence over the general handler.

Semantic DOM

Turn on highlighting in the Semantic DOM example to see the borders of elements. styles accepts CSS strings, classNames - class names; both options support object and function with props.

SlotPurpose
rootRoot: alignment and typography.
imageDecorative illustration and its dimensions.
descriptionEmpty state label.
footerAdditional actions under the label.

The illustration is decorative and hidden from the accessibility tree. Convey the meaning of the state in the description text. For a dynamic action result, use a separate role="status"; Empty itself does not automatically announce changes.

Registration tokens

Empty does not have its own component tokens. Dimensions, padding, and label use common theme tokens. Semantic styles are suitable for designing one instance.

Common tokens of the current topic
TokenMeaning
colorTextDescriptionrgba(0,0,0,0.45)
controlHeightLG40
fontSize14
lineHeight1.5714285714285714
margin16
marginXL32
marginXS8
opacityImage1

FAQ

How is the empty state different from an error?

Empty means that the result was received, but there were no records. Loading and error require their own messages and actions.

How to change the language?

Pass locale to ConfigProvider. An explicit description will replace the localized caption; false will hide it.

Why did I lose focus after creating a post?

The Empty button is deleted along with its state. Bring focus to the area to be saved or to a new object before deleting.