Inline Notification
1.12.0Inline notifications provide contextual feedback without disrupting the user's workflow. They support multiple semantic types ranging from informational updates to critical warnings.
import {InlineNotification} from "@qualcomm-ui/react/inline-notification"Examples
Simple
Basic inline notification using the simple API with heading and description.
<InlineNotification
className="w-96"
description="Description"
dismissable
label="Label"
/>
Composite
Use the composite API with individual components for more granular control.
<InlineNotification.Root className="w-96">
<InlineNotification.Icon />
<InlineNotification.Label>Label</InlineNotification.Label>
<InlineNotification.Description>
Description
</InlineNotification.Description>
</InlineNotification.Root>
Emphasis (color)
Control the visual emphasis with different colors: info, success, warning, danger, and neutral. Customize these with the emphasis prop.
<InlineNotification emphasis="info" label="info" />
<InlineNotification emphasis="success" label="success" />
<InlineNotification emphasis="warning" label="warning" />
<InlineNotification emphasis="danger" label="danger" />
<InlineNotification emphasis="neutral" label="neutral" />
Dismissable
Add dismiss functionality to the simple notification using the dismissable prop. Use the <InlineNotification.CloseButton /> component when using the composite API.
<InlineNotification dismissable label="Simple" />
<InlineNotification.Root>
<InlineNotification.Icon />
<InlineNotification.Label>Composite</InlineNotification.Label>
<InlineNotification.CloseButton />
</InlineNotification.Root>
Action
Include action links in notifications using the action property or the <InlineNotification.Action> component via the composite API.
import type {ReactElement} from "react"
import {InlineNotification} from "@qualcomm-ui/react/inline-notification"
import {Link} from "@qualcomm-ui/react/link"
export function InlineNotificationActionDemo(): ReactElement {
return (
<div className="flex flex-col gap-4">
<InlineNotification
action={<Link>Text link</Link>}
description="Description for action demo"
label="Simple"
/>
<InlineNotification.Root>
<InlineNotification.Icon />
<InlineNotification.Label>Composite</InlineNotification.Label>
<InlineNotification.Description>
Description for action demo
</InlineNotification.Description>
<InlineNotification.ActionContainer>
<Link>Text link</Link>
</InlineNotification.ActionContainer>
</InlineNotification.Root>
</div>
)
}Layout
Choose between inline and stacked layouts using the orientation property. Stacked layout places the description and action below the content.
<InlineNotification
action={<Link size="sm">Text link</Link>}
description="Description for horizontal orientation"
dismissable
label="Horizontal"
/>
<InlineNotification
action={<Link size="sm">Text link</Link>}
description="Description for vertical orientation"
dismissable
label="Vertical"
orientation="vertical"
/>
Explorer
Component Anatomy
Hover to highlight, click to view API
API
<InlineNotificaton>
The InlineNotification component supports every property from the InlineNotification.Root component, plus the props listed below.
booleantrue, renders a close button that dismisses the notification on click.| LucideIcon
| ReactNode
Composite API
<InlineNotification.Root>
'ltr' | 'rtl'
| 'info'
| 'success'
| 'warning'
| 'danger'
| 'neutral'
| 'loading'
() =>
| Node
| ShadowRoot
| Document
string() => void
| 'horizontal'
| 'vertical'
| ReactElement
| ((
props: object,
) => ReactElement)
<InlineNotification.Icon>
<span> element by
default.| LucideIcon
| ReactNode
| ReactElement
| ((
props: object,
) => ReactElement)
className'qui-notification__icon'data-inline-notification-part'status-icon'<InlineNotification.Label>
<div> element by default.string| ReactElement
| ((
props: object,
) => ReactElement)
className'qui-notification__label'data-inline-notification-part'heading'<InlineNotification.Description>
<div>
element by default.string| ReactElement
| ((
props: object,
) => ReactElement)
className'qui-notification__description'data-inline-notification-part'description'<InlineNotification.CloseButton>
<button> element by default.string| ReactElement
| ((
props: object,
) => ReactElement)
className'qui-notification__close-button'data-inline-notification-part'close-trigger'<InlineNotification.ActionContainer>
<div>
element by default.| ReactElement
| ((
props: object,
) => ReactElement)
className'qui-notification__action'data-inline-notification-part'action'data-orientation| 'horizontal'
| 'vertical'
<div>element by default.