DmTabs
DmTabs documents the DmTabs export from duskmoon.
@duskmoon-dev/components/dm-tabs 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.
DmTabs is most often configured through `items`, `transparentCard`, `optionTree`, `destroyOnHidden`.
Renders line workflow tabs with Dm shell and class names
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 DmTabs from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { DmTabs } from "@duskmoon-dev/components/dm-tabs";
export function Example() {
return (<DmTabs
items={[{ key: "main", label: "Main", title: "Main" }]}
>
DuskMoon Dm Tabs
</DmTabs>);
} Renders line workflow tabs with Dm shell and class names
test-backedDmTabs scenario from the component test coverage: renders line workflow tabs with dm shell and class names.
import "@duskmoon-dev/components/styles.css";
import { DmTabs } from "@duskmoon-dev/components/dm-tabs";
export function DmTabsRendersLineWorkflowTabsDemo() {
return (<DmTabs
// Renders line workflow tabs with Dm shell and class names
items={[{ key: "main", label: "Main", title: "Main" }]}
>
DuskMoon Dm Tabs
</DmTabs>);
} Uses vertical line class for side tab positions
test-backedDmTabs scenario from the component test coverage: uses vertical line class for side tab positions.
import "@duskmoon-dev/components/styles.css";
import { DmTabs } from "@duskmoon-dev/components/dm-tabs";
export function DmTabsUsesVerticalLineClassDemo() {
return (<DmTabs
// Uses vertical line class for side tab positions
items={[{ key: "main", label: "Main", title: "Main" }]}
>
DuskMoon Dm Tabs
</DmTabs>);
} Supports transparent card and option tree workflow variants
test-backedDmTabs scenario from the component test coverage: supports transparent card and option tree workflow variants.
import "@duskmoon-dev/components/styles.css";
import { DmTabs } from "@duskmoon-dev/components/dm-tabs";
export function DmTabsSupportsTransparentCardAndDemo() {
return (<DmTabs
// Supports transparent card and option tree workflow variants
items={[{ key: "main", label: "Main", title: "Main" }]}
>
DuskMoon Dm Tabs
</DmTabs>);
} Maps destroyOnHidden to primitive inactive pane destruction
test-backedDmTabs scenario from the component test coverage: maps destroyonhidden to primitive inactive pane destruction.
import "@duskmoon-dev/components/styles.css";
import { DmTabs } from "@duskmoon-dev/components/dm-tabs";
export function DmTabsMapsDestroyOnHiddenToPrimitiveDemo() {
return (<DmTabs
// Maps destroyOnHidden to primitive inactive pane destruction
items={[{ key: "main", label: "Main", title: "Main" }]}
>
DuskMoon Dm Tabs
</DmTabs>);
} Keeps primitive onChange behavior and forwards root ref
test-backedDmTabs scenario from the component test coverage: keeps primitive onchange behavior and forwards root ref.
import "@duskmoon-dev/components/styles.css";
import { DmTabs } from "@duskmoon-dev/components/dm-tabs";
export function DmTabsKeepsPrimitiveOnChangeBehaviorDemo() {
return (<DmTabs
// Keeps primitive onChange behavior and forwards root ref
items={[{ key: "main", label: "Main", title: "Main" }]}
>
DuskMoon Dm Tabs
</DmTabs>);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<DmTabs
items={[{ key: "main", label: "Main", title: "Main" }]}
>
DuskMoon Dm Tabs
</DmTabs>
</div>
<div data-theme="moonlight">
<DmTabs
items={[{ key: "main", label: "Main", title: "Main" }]}
>
DuskMoon Dm Tabs
</DmTabs>
</div> API
The API reference below lists every parsed exported type or interface for DmTabs. Start with `items`, `transparentCard`, `optionTree`, `destroyOnHidden` for common usage.
packages/components/src/components/dm-tabs/DmTabs.types.ts
Scenarios: packages/components/src/components/dm-tabs/DmTabs.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
items | DmTabsItem[] | Yes | items configures DmTabs. |
transparentCard | boolean | No | transparentCard configures DmTabs. |
optionTree | boolean | No | optionTree configures DmTabs. |
destroyOnHidden | boolean | No | destroyOnHidden configures DmTabs. |
| Prop | Type | Required | Description |
|---|---|---|---|
path | string | No | path configures DmTabs. |