default
Launch a default notification to compare its actual colors and comic animation.
variant="default"
WelkUI!REACT EDITIONExplore live variants, compare states, and learn every prop. Pick a component to start.
A controlled, portaled notification with comic pop-in and exit animations and a polite status announcement. Update open in onClose. A positive autoHideDuration requests dismissal after that many milliseconds; hover or focus pauses it and leaving restarts the full duration. Motion respects reduced-motion preferences.
import { useState } from "react";
import { WelkButton, WelkSnackBar } from "@welkui/react";
const [open, setOpen] = useState(false);
<WelkButton onClick={() => setOpen(true)}>Notify me</WelkButton>
<WelkSnackBar open={open} onClose={() => setOpen(false)}
message="POW! Saved." position="bottom-middle" />Import @welkui/react/styles.css once in your app. Stateful snippets belong inside a React component.
These are real components, not screenshots. Compare their appearance and try the controls. Key props below each preview show what changes; use the usage example above for imports and component setup.
Launch a default notification to compare its actual colors and comic animation.
variant="default"Launch a info notification to compare its actual colors and comic animation.
variant="info"Launch a success notification to compare its actual colors and comic animation.
variant="success"Launch a warning notification to compare its actual colors and comic animation.
variant="warning"Launch a error notification to compare its actual colors and comic animation.
variant="error"Launch at the viewport's top-left anchor. Dismiss before comparing another position.
position="top-left"Launch at the viewport's top-middle anchor. Dismiss before comparing another position.
position="top-middle"Launch at the viewport's top-right anchor. Dismiss before comparing another position.
position="top-right"Launch at the viewport's bottom-left anchor. Dismiss before comparing another position.
position="bottom-left"Launch at the viewport's bottom-middle anchor. Dismiss before comparing another position.
position="bottom-middle"Launch at the viewport's bottom-right anchor. Dismiss before comparing another position.
position="bottom-right"Closes after 4 seconds; hover or focus pauses the countdown, leaving restarts it.
autoHideDuration={4000}Required props are marked in the default column. Other props are optional. ReactNode accepts text or JSX.
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | Required | Controlled notification visibility. |
onClose | () => void | Required | Dismissal request from the close button or timer; update open. |
message | ReactNode | Required | Notification content. |
position | "top-left" | "top-middle" | "top-right" | "bottom-left" | "bottom-middle" | "bottom-right" | "bottom-middle" | Viewport anchor. |
variant | "default" | "info" | "success" | "warning" | "error" | "default" | Notification color treatment. |
autoHideDuration | number | 0 | Non-negative finite duration in milliseconds; 0 disables automatic dismissal. |
closeLabel | string | "Dismiss notification" | Accessible name for the close button. |
className | string | Unset | Additional CSS class on the component root. |
This component supports the props listed above, not arbitrary native HTML attributes.
Import @welkui/react/styles.css once in your app entry or Next.js root layout. The previews use the default theme; override --welk-* CSS tokens in your app to customize it.
For Next.js, put hooks and event handlers in a component beginning with "use client". Keep state local to the component using the control. The library preserves its client boundaries and uses your installed React version.
Use defaultValue or defaultChecked for uncontrolled fields, or a state value and its change callback for controlled fields. Do not switch between these modes during the lifetime of a field.
Modal and notification examples start closed: use their Try buttons to see them. Disabled examples are deliberately non-interactive. Validate forms, uploads, authentication, and server responses in your application; these components only provide UI.