Mosmox UI
Current version
GitHubnpmjs.com
Feedback & Status

Empty

A centered empty-state component for missing, unavailable or not-yet-created content.

Empty communicates that a collection, search, page or data region has no content to display. It centers an illustration, optional subtitle, title, description, custom content and actions in one consistent surface. It supports regular and compact modes, bordered and borderless surfaces, localization, provider defaults, and full-width layouts.

Basic usage

The component uses a monochrome empty-state illustration by default. The default container has a dashed border and uses the default size.

<Empty
  title="No documents yet"
  description="Create your first document to get started."
  actions={<Button>Create document</Button>}
/>

Use fullWidth when the empty state should occupy the whole available region.

Content and actions

subtitle adds a small contextual label above the title. content accepts any React content, such as a hint, filter summary, form fragment or custom message. actions is intended for buttons or links and is centered below the content. children is an alias for content; when both are supplied, content wins.

<Empty
  subtitle="Search results"
  title="Nothing found"
  description="Try changing your filters or search terms."
  content={<span>Search supports names, tags and descriptions.</span>}
  actions={
    <>
      <Button variant="primary">Clear filters</Button>
      <Button variant="outline">Try again</Button>
    </>
  }
/>

Illustration

The default illustration is the project’s monochrome empty-state asset. Pass imageSrc to use another image, or pass imageContent to replace the image with any React content: an image component, SVG, icon, illustration, or custom markup. The older image prop remains supported as an alias. imageContent takes precedence over image, and both take precedence over the default image. imageAlt supplies alternative text when the default or imageSrc image is used.

<Empty imageSrc="/illustrations/no-results.png" imageAlt="No search results" />
<Empty imageContent={<SearchX aria-hidden="true" size={72} />} title="No results" />
<Empty imageContent={<MyCustomIllustration />} title="Custom empty state" />

Illustration resolution follows this order: imageContent, then the legacy image prop, then imageSrc, then the default project illustration. This makes it possible to provide arbitrary content without changing the rest of the empty state.

Sizes and border

size="default" is intended for page-level empty states and uses a 176×176px illustration area. size="sm" uses a 112×112px illustration area together with smaller typography and spacing for compact panels, tables and cards. The dashed border is enabled by default; set bordered={false} for a borderless presentation.

<Empty size="default" />
<Empty size="sm" bordered={false} />

Localization and ConfigProvider

Built-in fallback title and description are available in en, uk, de and fr. Set the global language with ConfigProvider; an Empty-level locale overrides it. Explicit title and description always take precedence over translated defaults.

<ConfigProvider locale="uk">
  <Empty actions={<Button>Створити документ</Button>} />
</ConfigProvider>

<Empty locale="fr" />

ConfigProvider can also define defaults for all nested Empty components:

<ConfigProvider components={{ empty: { size: 'sm', bordered: false } }}>
  <Empty title="Compact empty state" />
</ConfigProvider>

Component props override ConfigProvider.components.empty values.

API Reference

PropTypeDefaultDescription
titleReactNodelocalized titleMain heading.
descriptionReactNodelocalized descriptionSupporting explanation.
subtitleReactNode—Optional contextual label above the title.
content / childrenReactNode—Custom content below the description. children aliases content.
actionsReactNode—Centered action content, usually buttons or links.
imageContentReactNode—Replaces the image with any React content. Takes precedence over image and imageSrc.
imageReactNode—Legacy alias for custom illustration content.
imageSrcstring/empty/empty-state-illustration.pngImage source used when neither imageContent nor image is provided.
imageAltstring''Alternative text for the image.
sizesm | defaultdefaultCompact or regular spacing; illustration area is 112×112px for sm and 176×176px for default.
borderedbooleantrueShows the dashed container border.
fullWidthbooleanfalseStretches the container to the available width.
localeen | uk | de | frConfigProvider locale or enLanguage for fallback title and description.
aria-labelstring—Accessible name for the empty-state region.
classNamestring—Additional class name on the root element.

ConfigProvider defaults

The empty component configuration supports the following defaults:

ConfigTypeDefaultDescription
components.empty.sizesm | defaultdefaultDefault size for nested Empty components.
components.empty.borderedbooleantrueDefault dashed-border visibility.

Individual props have priority over provider defaults.