Divider
Divider separates dense content while preserving visual rhythm.
@duskmoon-dev/components/divider 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.
Divider is most often configured through `orientation`, `variant`, `thickness`, `color`.
Renders a separator with default classes
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Colors
Divider supports the full semantic color palette: primary, secondary, tertiary, accent, neutral, base, info, success, warning, error.
import "@duskmoon-dev/components/styles.css";
import { Divider } from "@duskmoon-dev/components/divider";
const colors = [
"primary",
"secondary",
"tertiary",
"accent",
"neutral",
"base",
"info",
"success",
"warning",
"error"
] as const;
export function DividerColorsDemo() {
return (<div style={{ display: "grid", gap: 14 }}>
{colors.map((color) => (
<Divider key={color} color={color}>
{color}
</Divider>
))}
</div>);
} Basic usage
Import the component stylesheet and Divider from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { Divider } from "@duskmoon-dev/components/divider";
export function Example() {
return (<Divider
color="primary"
>
DuskMoon Divider
</Divider>);
} Renders a separator with default classes
test-backedDivider scenario from the component test coverage: renders a separator with default classes.
import "@duskmoon-dev/components/styles.css";
import { Divider } from "@duskmoon-dev/components/divider";
export function DividerRendersASeparatorWithDemo() {
return (<Divider
// Renders a separator with default classes
color="primary"
>
DuskMoon Divider
</Divider>);
} Applies vertical, variant, color, thickness, and spacing classes
test-backedDivider scenario from the component test coverage: applies vertical, variant, color, thickness, and spacing classes.
import "@duskmoon-dev/components/styles.css";
import { Divider } from "@duskmoon-dev/components/divider";
export function DividerAppliesVerticalVariantColorDemo() {
return (<Divider
// Applies vertical, variant, color, thickness, and spacing classes
color="primary"
>
DuskMoon Divider
</Divider>);
} Renders label content with label position classes
test-backedDivider scenario from the component test coverage: renders label content with label position classes.
import "@duskmoon-dev/components/styles.css";
import { Divider } from "@duskmoon-dev/components/divider";
export function DividerRendersLabelContentWithDemo() {
return (<Divider
// Renders label content with label position classes
color="primary"
>
DuskMoon Divider
</Divider>);
} Applies custom className
test-backedDivider scenario from the component test coverage: applies custom classname.
import "@duskmoon-dev/components/styles.css";
import { Divider } from "@duskmoon-dev/components/divider";
export function DividerAppliesCustomClassNameDemo() {
return (<Divider
// Applies custom className
color="primary"
>
DuskMoon Divider
</Divider>);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<Divider
color="primary"
>
DuskMoon Divider
</Divider>
</div>
<div data-theme="moonlight">
<Divider
color="primary"
>
DuskMoon Divider
</Divider>
</div> API
The API reference below lists every parsed exported type or interface for Divider. Start with `orientation`, `variant`, `thickness`, `color` for common usage.
packages/components/src/components/divider/Divider.types.ts
Scenarios: packages/components/src/components/divider/Divider.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
orientation | DividerOrientation | No | orientation configures Divider. |
variant | DividerVariant | No | variant configures Divider. |
thickness | DividerThickness | No | thickness configures Divider. |
color | DividerColor | No | color configures Divider. |
spacing | DividerSpacing | No | spacing configures Divider. |
labelPosition | "center" | "left" | "right" | No | labelPosition configures Divider. |
"horizontal" | "vertical" "solid" | "dashed" | "dotted" "thin" | "medium" | "thick" | "primary" | "secondary" | "tertiary" | "accent" | "neutral" | "base" | "info" | "success" | "warning" | "error" "normal" | "compact" | "comfortable" | "spacious"