Skip to content
Theme:

Ui3nNotification ​

Notification component for displaying messages with different types and positions.

Props

NameTypeDefaultDescription
idstring | undefined —

Notification ID

type"error" | "success" | "info" | "warning" | undefined"info"

Notification type

content*string —

Notification content

position"right" | "left" | "center" | undefined"center"

Notification position

durationnumber | undefined0

Notification duration in milliseconds

withIconboolean | undefinedtrue

Whether to display icon

borderRadiusstring | number | undefined8

Notification border radius in pixels or css length

onOpen(() => void) | undefined() => { }

Called when notification opens

onClose(() => void) | undefined() => { }

Called when notification closes

CSS Variables

Set any of these where you need it — on :root, on a container, or on the element itself through [data-ui3n] — and the component follows. Leave them alone and it uses the defaults below.

NameDefault
--ui3n-notification-border-radius8px
--ui3n-notification-font-size12px
--ui3n-notification-icon-size32px
--ui3n-notification-margin-bottom4px
--ui3n-notification-padding16px
--ui3n-notification-text-colorvar(--default-content-default)
--ui3n-notification-width380px

Usage Examples ​

Basic notification ​

Basic notification

Simple notification with default settings

Notification types ​

Notification types

Different notification types: success, warning, info, error

Operation completed successfully
Please review your input
Here is some useful information
An error occurred during processing

Custom border radius ​

Custom border radius

Customize border radius using the borderRadius prop (pixels or CSS length)

Square corners (borderRadius: 0)
Default radius (borderRadius: 8px)
Large radius (borderRadius: 16px)
Pill shape (borderRadius: 24px)

Auto-close notification ​

Auto-close notification

Notification that closes automatically after specified duration