Empty
Empty explains an empty content state and gives the user a next step.
@duskmoon-dev/components/empty Usage
When to use
- Use it to clarify state, metadata, content hierarchy, or loading without creating a new workflow.
- Pair it with semantic content so visual treatment never becomes the only source of meaning.
Implementation notes
Features
Focuses on status, metadata, empty/loading states, or content grouping without owning application state.
Uses DuskMoon tokens so the component follows the active docs theme.
Empty is most often configured through `image`, `imageStyle`, `description`, `PRESENTED_IMAGE_DEFAULT`.
Renders default empty state
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Basic usage
Import the component stylesheet and Empty from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { Empty } from "@duskmoon-dev/components/empty";
export function Example() {
return (<Empty>DuskMoon Empty</Empty>);
} Renders default empty state
test-backedEmpty scenario from the component test coverage: renders default empty state.
import "@duskmoon-dev/components/styles.css";
import { Empty } from "@duskmoon-dev/components/empty";
export function EmptyRendersDefaultEmptyStateDemo() {
return (<Empty>DuskMoon Empty</Empty>);
} Renders custom description and children
test-backedEmpty scenario from the component test coverage: renders custom description and children.
import "@duskmoon-dev/components/styles.css";
import { Empty } from "@duskmoon-dev/components/empty";
export function EmptyRendersCustomDescriptionAndDemo() {
return (<Empty>DuskMoon Empty</Empty>);
} Hides description when description is false
test-backedEmpty scenario from the component test coverage: hides description when description is false.
import "@duskmoon-dev/components/styles.css";
import { Empty } from "@duskmoon-dev/components/empty";
export function EmptyHidesDescriptionWhenDescriptionDemo() {
return (<Empty>DuskMoon Empty</Empty>);
} Supports custom className and static image constants
test-backedEmpty scenario from the component test coverage: supports custom classname and static image constants.
import "@duskmoon-dev/components/styles.css";
import { Empty } from "@duskmoon-dev/components/empty";
export function EmptySupportsCustomClassNameAndDemo() {
return (<Empty>DuskMoon Empty</Empty>);
} Forwards root ref
test-backedEmpty scenario from the component test coverage: forwards root ref.
import "@duskmoon-dev/components/styles.css";
import { Empty } from "@duskmoon-dev/components/empty";
export function EmptyForwardsRootRefDemo() {
return (<Empty>DuskMoon Empty</Empty>);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<Empty>DuskMoon Empty</Empty>
</div>
<div data-theme="moonlight">
<Empty>DuskMoon Empty</Empty>
</div> API
The API reference below lists every parsed exported type or interface for Empty. Start with `image`, `imageStyle`, `description`, `PRESENTED_IMAGE_DEFAULT` for common usage.
packages/components/src/components/empty/Empty.types.ts
Scenarios: packages/components/src/components/empty/Empty.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
image | ReactNode | No | image configures Empty. |
imageStyle | React.CSSProperties | No | imageStyle configures Empty. |
description | ReactNode | false | No | description configures Empty. |
children | ReactNode | No | children configures Empty. |
| Prop | Type | Required | Description |
|---|---|---|---|
PRESENTED_IMAGE_DEFAULT | ReactNode | Yes | PRESENTED_IMAGE_DEFAULT configures Empty. |
PRESENTED_IMAGE_SIMPLE | ReactNode | Yes | PRESENTED_IMAGE_SIMPLE configures Empty. |