Feedbackduskmoonimplemented6 demos

notification

notification shows global notices that need more context than a message.

Import@duskmoon-dev/components/notification
8API sections
30documented props
4behavior scenarios
Key API
placementdurationmaxCounttopbottomcloseIcon

Usage

When to use

  • Use it immediately after user actions or system checks that need visible confirmation.
  • Choose the least interruptive feedback surface that still makes the state clear.

Implementation notes

StylesheetImport @duskmoon-dev/components/styles.css once in the app or docs shell.
StateStart with default props for static examples, then switch to controlled props when state must be shared.
ThemeThe preview inherits the active DuskMoon data-theme value from the docs layout.

Features

User feedback

Covers transient, inline, or blocking feedback patterns for user actions and system status.

Action recovery

Shows how the component keeps next actions visible after success, warning, or failure states.

Primary API surface

notification is most often configured through `placement`, `duration`, `maxCount`, `top`.

Covered behavior

Opens typed notifications with placement and description

Feature Demos

Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.

Preview

Basic usage

authored

Import the component stylesheet and notification from its package subpath, then render it with the core props.

Source
import "@duskmoon-dev/components/styles.css";
import { notification } from "@duskmoon-dev/components/notification";

export function Example() {
  return (<notification>DuskMoon Notification</notification>);
}
Preview

Opens typed notifications with placement and description

test-backed

notification scenario from the component test coverage: opens typed notifications with placement and description.

Source
import "@duskmoon-dev/components/styles.css";
import { notification } from "@duskmoon-dev/components/notification";

export function notificationOpensTypedNotificationsWithDemo() {
  return (<notification>DuskMoon Notification</notification>);
}
Preview

Supports key updates, close, destroy, and onClose

test-backed

notification scenario from the component test coverage: supports key updates, close, destroy, and onclose.

Source
import "@duskmoon-dev/components/styles.css";
import { notification } from "@duskmoon-dev/components/notification";

export function notificationSupportsKeyUpdatesCloseDemo() {
  return (<notification>DuskMoon Notification</notification>);
}
Preview

Config applies maxCount and custom close icon

test-backed

notification scenario from the component test coverage: config applies maxcount and custom close icon.

Source
import "@duskmoon-dev/components/styles.css";
import { notification } from "@duskmoon-dev/components/notification";

export function notificationConfigAppliesMaxCountAndDemo() {
  return (<notification>DuskMoon Notification</notification>);
}
Preview

UseNotification returns scoped api and context holder

test-backed

notification scenario from the component test coverage: usenotification returns scoped api and context holder.

Source
import "@duskmoon-dev/components/styles.css";
import { notification } from "@duskmoon-dev/components/notification";

export function notificationUseNotificationReturnsScopedApiDemo() {
  return (<notification>DuskMoon Notification</notification>);
}
Preview

Theme aware

authored

Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.

Source
<div data-theme="sunshine">
  <notification>DuskMoon Notification</notification>
</div>

<div data-theme="moonlight">
  <notification>DuskMoon Notification</notification>
</div>

API

The API reference below lists every parsed exported type or interface for notification. Start with `placement`, `duration`, `maxCount`, `top` for common usage.

Types: packages/components/src/components/notification/Notification.types.tsScenarios: packages/components/src/components/notification/Notification.test.tsx
NotificationConfiginterface
PropTypeRequiredDescription
placementNotificationPlacementNoplacement configures notification.
durationnumber | nullNoduration configures notification.
maxCountnumberNomaxCount configures notification.
topnumberNotop configures notification.
bottomnumberNobottom configures notification.
closeIconReactNodeNocloseIcon configures notification.
getContainer() => HTMLElementNogetContainer configures notification.
NotificationArgsPropsinterface
PropTypeRequiredDescription
keyNotificationKeyNokey configures notification.
messageReactNodeYesmessage configures notification.
descriptionReactNodeNodescription configures notification.
btnReactNodeNobtn configures notification.
iconReactNodeNoicon configures notification.
closeIconReactNodeNocloseIcon configures notification.
placementNotificationPlacementNoplacement configures notification.
durationnumber | nullNoduration configures notification.
typeNotificationTypeNotype configures notification.
classNamestringNoclassName configures notification.
styleCSSPropertiesNostyle configures notification.
role"alert" | "status"Norole configures notification.
onClick() => voidNoonClick configures notification.
onClose() => voidNoonClose configures notification.
NotificationApiinterface
PropTypeRequiredDescription
open(config: NotificationArgsProps) => voidYesopen configures notification.
success(config: NotificationArgsProps) => voidYessuccess configures notification.
info(config: NotificationArgsProps) => voidYesinfo configures notification.
warning(config: NotificationArgsProps) => voidYeswarning configures notification.
error(config: NotificationArgsProps) => voidYeserror configures notification.
close(key: NotificationKey) => voidYesclose configures notification.
destroy(key?: NotificationKey) => voidYesdestroy configures notification.
NotificationStaticApiinterface extends NotificationApi
PropTypeRequiredDescription
config(config: NotificationConfig) => voidYesconfig configures notification.
useNotificationNotificationUseNotificationYesuseNotification configures notification.
NotificationTypetype
"success" | "info" | "warning" | "error"
NotificationPlacementtype
"top" | "topLeft" | "topRight" | "bottom" | "bottomLeft" | "bottomRight"
NotificationKeytype
string | number
NotificationUseNotificationtype
( config?: NotificationConfig, ) => [NotificationApi, ReactNode]