Overview

Transient or persistent notifications.

Import

import { Notification } from 'nikcli-tui';

Usage

new Notification({ parent: screen, message: 'Heads up!' });

Live Preview

Run Locally

npm run tsx:core-gallery

Props

  • message: string — Body text.
  • title?: string — Label.
  • type?: ‘info’ | ‘success’ | ‘warning’ | ‘error’ — Visual accent.
  • duration?: number — Auto-close duration in ms.
  • autoClose?: boolean — Enable/disable timer (default true if duration set).
  • BaseProps: container styling.

Methods

  • setMessage(text), setTitle(text), setType(type).
  • setDuration(ms), setAutoClose(bool), close(), show(), hide().
  • getType(), getMessage().

Statics

  • Notification.info/success/warning/error(message, title?).

Installation

npm i nikcli-tui

Import

import { Notification } from 'nikcli-tui';

Quick Start

new Notification({ parent: screen, title: 'Info', message: 'Saved', type: 'success', duration: 2000, autoClose: true });

Production Examples

Notification.info('Network check');
Notification.success('Deployed', 'Success');
Notification.warning('High load');
Notification.error('Failed');

Best Practices

  • Usa autoClose per feedback transiente; evita stacking eccessivo.