Seen

Make component "permanently" dismissible

Basic usage

Demonstrates the essential props: id, render, and children.

Inline usage

Use Seen to wrap any UI that should only be shown until the user dismisses it. Provide a stable id and a render function that gets dismiss and isDismissed.

Resetting dismissal state

Shows how to use resetDismissedState function to clear dismissal state.

Use resetDismissedState to clear a specific key or all Seen states. This is useful for demos, QA, or when you want to re-show a message after product changes.

import { resetDismissedState } from '@ntds/seen';
// Reset one
resetDismissedState('welcome-banner');
// Or reset all Seen states
resetDismissedState();

Gotchas

  • Ensure the id is unique and stable across renders; it is used as the storage key.
  • Dismissal is persisted in localStorage under a namespaced key.
  • render receives { dismiss, children, isDismissed }; you decide when to call dismiss().

This guide is based on version: 1.0.1