Skip to content
Get started

Components

NotificationItem

Unstable: one row of activity in a panel or an inbox, who did what and when, as one link; unread rows are tinted, carry a dot and say "Unread". Import it from @nizivo/react/unstable/notification-item.

Server component, no client JSUnstable

Examples

Basic

Two rows in a panel: an unread comment and a read one.

import type { JSX } from 'react';
import { Avatar } from '@nizivo/react/avatar';
import { NotificationItem } from '@nizivo/react/unstable/notification-item';

export function NotificationItemExample(): JSX.Element {
  return (
    <div style={{ display: 'grid', gap: 4, maxInlineSize: 420 }}>
      <NotificationItem
        href="/posts/autumn-launch#comments"
        unread
        avatar={<Avatar name="Jonah Okafor" decorative />}
        title="Jonah Okafor commented on Autumn launch"
        detail="“Love the new cover photo — ship it.”"
        time={<time dateTime="2026-10-28T09:39">2 min ago</time>}
      />
      <NotificationItem
        href="/orders/1042"
        avatar={<Avatar name="Maya Rao" decorative />}
        title="Maya Rao placed order #1042"
        detail="2 items · $84.00"
        time={<time dateTime="2026-10-28T08:12">1 h ago</time>}
      />
    </div>
  );
}

Import

import { NotificationItem } from '@nizivo/react/unstable/notification-item';

// Once per app (Getting started), after
// @nizivo/tokens/tokens.css and @nizivo/react/css/base.css
import '@nizivo/react/css/notification-item.css';

Static or interactive

Server. No client JavaScript: the row is a link (href, or render for a router link). How to choose.

Content

title says what happened, detail adds a quote or a figure and time when (a <time> is best). avatar takes an Avatar, decorative since the title names the person. unread tints the row, adds a dot and starts its name with "Unread" (labels.unread), so the state is never the tint alone.

Props

Server component Renders data-slot="notification-item" with the class nz-notification-item. Props: NotificationItemProps. Source: src/unstable/notification-item/notification-item.tsx.

NameTypeDefaultDescription
avatarReactNode–

An Avatar of who did it; decorative, since the title names them.

detailReactNode–

A line under it: a quote, a detail.

labelsPartial<NotificationItemLabels>–
renderRenderProp<Record<string, never>>–

Must render an <a>, or a router link that renders one.

timeReactNode–

When, after the detail: a <time> is best.

titlerequiredReactNode–

What happened: "Jonah Okafor commented on Autumn launch".

unreadbooleanfalse
  • Also takes every attribute of <a> except title. (Omit<ComponentPropsWithRef<"a">, "title">)

render takes an element, or, in client code, a function of the props and no state.

Other exports

NotificationItemLabels type

import type { NotificationItemLabels } from '@nizivo/react/unstable/notification-item'

NotificationItem's own strings (§16.4): serialisable, English defaults.

NameTypeDefaultDescription
unreadrequiredstring'Unread'

Read before an unread row's title.

NotificationItemProps type

import type { NotificationItemProps } from '@nizivo/react/unstable/notification-item'

The props of NotificationItem, listed above.

Data attributes and slots

Style parts by class (.nz-<slot>) and state by data attribute. Attribute meanings come from contracts/vocabulary.json.

SlotRendered byData attributes
notification-item
.nz-notification-item
NotificationItem
root (takes render); interactive, focus: self
  • data-variant: "unread""read"
    The variant prop; values in each component manifest
notification-item-detail
.nz-notification-item-detail
NotificationItem
inner element (CSS only)
none
notification-item-title
.nz-notification-item-title
NotificationItem
inner element (CSS only)
none

CSS hooks

Set a hook on the component's class or any ancestor to restyle it without specificity games; leave it unset for the default shown.

This stylesheet reads no public hook.

Layers: nz.components. Classes: .nz-notification-item, .nz-notification-item-avatar, .nz-notification-item-detail, .nz-notification-item-dot, .nz-notification-item-text, .nz-notification-item-title.

Tokens this stylesheet reads (17)

--nz-bg-brand, --nz-bg-brand-subtle, --nz-bg-hover, --nz-duration-fast, --nz-easing-standard, --nz-font-body-s, --nz-font-label-m, --nz-radius-full, --nz-radius-lg, --nz-space-0-5, --nz-space-1, --nz-space-1-5, --nz-space-2, --nz-space-3, --nz-space-4, --nz-text-primary, --nz-text-secondary

Accessibility

These parts are interactive. Each gets the focus outline and touch-action rule from @nizivo/react/css/base.css (the nz.base layer), so the floor survives a restyle:

  • notification-item: draws the focus outline itself on keyboard focus.

Keyboard

To be written.

On this page