DmStatus
DmStatus documents the DmStatus export from duskmoon.
@duskmoon-dev/components/dm-status Usage
When to use
- Use it in DuskMoon application screens that need a packaged, opinionated workflow component.
- Reach for the lower-level standard component when the screen needs custom composition.
Implementation notes
Features
Wraps lower-level primitives into a higher-level DuskMoon-prefixed workflow API.
Examples show the defaults and composition points expected by internal DuskMoon app screens.
DmStatus is most often configured through `status`, `height`, `loadingProps`, `description`.
Renders empty status with default description and numeric height
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 DmStatus from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { DmStatus } from "@duskmoon-dev/components/dm-status";
export function Example() {
return (<DmStatus
status="success"
>
DuskMoon Dm Status
</DmStatus>);
} Renders empty status with default description and numeric height
test-backedDmStatus scenario from the component test coverage: renders empty status with default description and numeric height.
import "@duskmoon-dev/components/styles.css";
import { DmStatus } from "@duskmoon-dev/components/dm-status";
export function DmStatusRendersEmptyStatusWithDemo() {
return (<DmStatus
// Renders empty status with default description and numeric height
status="success"
>
DuskMoon Dm Status
</DmStatus>);
} Renders error status with custom description and action
test-backedDmStatus scenario from the component test coverage: renders error status with custom description and action.
import "@duskmoon-dev/components/styles.css";
import { DmStatus } from "@duskmoon-dev/components/dm-status";
export function DmStatusRendersErrorStatusWithDemo() {
return (<DmStatus
// Renders error status with custom description and action
status="success"
>
DuskMoon Dm Status
</DmStatus>);
} Renders loading status with spin props and children
test-backedDmStatus scenario from the component test coverage: renders loading status with spin props and children.
import "@duskmoon-dev/components/styles.css";
import { DmStatus } from "@duskmoon-dev/components/dm-status";
export function DmStatusRendersLoadingStatusWithDemo() {
return (<DmStatus
// Renders loading status with spin props and children
status="success"
>
DuskMoon Dm Status
</DmStatus>);
} Returns children directly for success status
test-backedDmStatus scenario from the component test coverage: returns children directly for success status.
import "@duskmoon-dev/components/styles.css";
import { DmStatus } from "@duskmoon-dev/components/dm-status";
export function DmStatusReturnsChildrenDirectlyForDemo() {
return (<DmStatus
// Returns children directly for success status
status="success"
>
DuskMoon Dm Status
</DmStatus>);
} Supports custom image string and className
test-backedDmStatus scenario from the component test coverage: supports custom image string and classname.
import "@duskmoon-dev/components/styles.css";
import { DmStatus } from "@duskmoon-dev/components/dm-status";
export function DmStatusSupportsCustomImageStringDemo() {
return (<DmStatus
// Supports custom image string and className
status="success"
>
DuskMoon Dm Status
</DmStatus>);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<DmStatus
status="success"
>
DuskMoon Dm Status
</DmStatus>
</div>
<div data-theme="moonlight">
<DmStatus
status="success"
>
DuskMoon Dm Status
</DmStatus>
</div> API
The API reference below lists every parsed exported type or interface for DmStatus. Start with `status`, `height`, `loadingProps`, `description` for common usage.
packages/components/src/components/dm-status/DmStatus.types.ts
Scenarios: packages/components/src/components/dm-status/DmStatus.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
status | DmStatusType | No | status configures DmStatus. |
height | string | number | No | height configures DmStatus. |
loadingProps | SpinProps | No | loadingProps configures DmStatus. |
description | ReactNode | No | description configures DmStatus. |
image | string | ReactNode | No | image configures DmStatus. |
children | ReactNode | No | children configures DmStatus. |
imageStyle | CSSProperties | No | imageStyle configures DmStatus. |
"empty" | "loading" | "error" | "success"