Skip to content

Alert Item

beta

The AlertItem component renders a single alert or notification row: a theme-colored left accent, title, relative timestamp, optional unread indicator, metadata line, and optional action link. Rows support full-row navigation via to/onClick while keeping nested action links independently clickable.

AlertItem deliberately ships without a list container. Render items inside any container you already use — a Card, a plain Layout.Vertical, or your own wrapper — and the row handles its own accent and corner rounding based on its position.

Usage

import { AlertItem } from '@harnessio/ui/components'
//...
return (
<AlertItem theme="info" read timestamp={timestamp} to="/alerts/1">
<AlertItem.Title>Company All-Hands This Friday</AlertItem.Title>
<AlertItem.Description>
Join us at 10:00 PT for the Q3 town hall...
</AlertItem.Description>
<AlertItem.Link to="/invite">View invite</AlertItem.Link>
</AlertItem>
)

To show several alerts, render multiple AlertItems inside any container of your choice.

Anatomy

All parts of the AlertItem component can be imported and composed as required.

<AlertItem theme="info" read timestamp={timestamp}>
<AlertItem.Title />
<AlertItem.Description />
<AlertItem.Link />
</AlertItem>

API Reference

AlertItem

Renders a single alert row with a theme accent, read/unread styling, and optional row navigation.

Prop
Required
Default
Type
themetrue'info' | 'success' | 'warning' | 'danger'
readfalsetrueboolean
timestampfalsestring | number | null
tofalsestring
linkPropsfalseOmit<LinkProps, 'to'>
onClickfalse() => void
childrentrueReactNode

Title

Primary heading shown in the item header row.

Prop
Required
Default
Type
childrentrueReactNode
classNamefalsestring

Description

Truncated description shown on the metadata line.

Prop
Required
Default
Type
childrentrueReactNode
classNamefalsestring

Optional action link rendered below the metadata line. Uses Alert link styling.

Prop
Required
Default
Type
totruestring
childrentrueReactNode
externalfalsefalseboolean