Ir al contenido

NotificationList

Una lista de notificaciones: las más nuevas primero, las sin leer con la luz, cada una con qué pasó y cuándo.

import { NotificationList, NotificationListSkeleton } from '@sypnia/ui/react'

En esta página
  1. En una página, junto a su skeleton
  2. Cuándo usarlo
  3. Para todos
  4. Props

En una página, junto a su skeleton

1 sin leer
Código
import { useState } from 'react';
import { NotificationList, NotificationListSkeleton, Panel, type NotificationEntry } from '@sypnia/ui/react';

// The same list on a page, beside its skeleton. Fixed dates, so the page reads the same on the server and in the browser.
const start: NotificationEntry[] = [
  { id: '1', title: 'Usage at 80% of the plan', body: 'Storage will be full in about 9 days at this pace.', at: '2026-11-16T09:30:00Z', unread: true, icon: 'usage', tone: 'warn' },
  { id: '2', title: 'New sign-in from Bogotá', at: '2026-11-12T18:05:00Z', icon: 'shield' },
];
export default function Page() {
  const [items, setItems] = useState(start);
  return (
    <div className="sy-grid">
      <Panel flush><NotificationList items={items} onOpen={() => {}} onReadAll={() => setItems(items.map((i) => ({ ...i, unread: false })))} /></Panel>
      <Panel flush><NotificationListSkeleton items={2} /></Panel>
    </div>
  );
}

Cuándo usarlo

Úsalo cuando

  • Dentro de la campana, o en una página propia.
  • Di qué pasó y, en el cuerpo, qué hacer al respecto.

No lo uses cuando

  • Mensajes largos: enlaza a la página que lo explica.

Para todos

  • Las sin leer dicen «Sin leer» a los lectores de pantalla, no solo con la luz.
  • Cada una es un enlace o un botón con su título como nombre.

Props

NotificationListTipoPor defecto
itemsobligatorio NotificationEntry[]
empty

Shown when there is nothing. Defaults to «Nothing new».

ReactNode
loading

The notifications are on their way: pass the last known ones (or typical ones) as `items`; each is drawn in its place, its icon, title, text and time as skeletons as long as theirs.

boolean
onOpen ((id: string) => void)
onReadAll (() => void)
NotificationListSkeletonTipoPor defecto
items number 3
  1. En una página, junto a su skeleton
  2. Cuándo usarlo
  3. Para todos
  4. Props

    Busca páginas, secciones y términos