Inline Notification

import {InlineNotification} from "@qualcomm-ui/react/inline-notification"

Examples

Simple

Basic inline notification using the simple API with heading and description.

Label
Description
<InlineNotification
  className="w-96"
  description="Description"
  dismissable
  label="Label"
/>

Composite

Use the composite API with individual components for more granular control.

Label
Description
<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.

info
success
warning
danger
neutral
<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.

Simple
Composite
<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.

Simple
Description for action demo
Composite
Description for action demo

Layout

Choose between inline and stacked layouts using the layout property. Stacked layout places the description and action below the content.

Horizontal
Description for horizontal orientation
Vertical
Description for vertical orientation
<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"
/>

API

<InlineNotificaton>

The InlineNotification component supports every property from the InlineNotification.Root component, plus the props listed below.

PropTypeDefault
The component used for the content of the action element.
Props applied to the action container element.
Props applied to the close button element.
Optional description text for the notification.
Props applied to the description element.
When true, renders a close button that dismisses the notification on click.
boolean
false
Override the icon displayed in the notification. When this prop is omitted, the icon is determined by the emphasis prop.
| LucideIcon
| ReactNode
Props applied to the icon element.
Optional heading text for the notification.
Props applied to the label element.
Description
The component used for the content of the action element.
Description
Props applied to the action container element.
Description
Props applied to the close button element.
Description
Optional description text for the notification.
Description
Props applied to the description element.
Type
boolean
Description
When true, renders a close button that dismisses the notification on click.
Type
| LucideIcon
| ReactNode
Description
Override the icon displayed in the notification. When this prop is omitted, the icon is determined by the emphasis prop.
Description
Props applied to the icon element.
Description
Optional heading text for the notification.
Description
Props applied to the label element.

Composite API

<InlineNotification.Root>

Groups all parts of the notification. Renders a <div> element by default.
PropTypeDefault
React children prop.
The document's text/writing direction.
'ltr' | 'rtl'
'ltr'
Governs the color of the notification and its icon.
| 'info'
| 'success'
| 'warning'
| 'danger'
| 'neutral'
| 'loading'
'info'
A root node to correctly resolve document in custom environments. i.e., Iframes, Electron.
    () =>
    | Node
    | ShadowRoot
    | Document
    id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
    string
    Function invoked when the notification is dismissed
      () => void
      The layout of the notification's elements.
      • 'horizontal': The icon, title, description, link, and close button are displayed inline.
      • 'vertical': The icon, title, and close button are placed on the first line, while the description, and link are stacked vertically and aligned with the title.
      | 'horizontal'
      | 'vertical'
      'horizontal'
      
      Allows you to replace the component's HTML element with a different tag or component. Learn more
      | ReactElement
      | ((
      props: object,
      ) => ReactElement)
      The WAI-ARIA role of the notification.
      • 'alert': Use this role when the notification is an alert that requires the user's immediate attention, like for errors or urgent information.
      • 'status': Use this role when the notification is a status message that doesn't require the user's immediate attention, like for success or informational messages.
      | 'status'
      | 'alert'
      'status'
      
      Description
      React children prop.
      Type
      'ltr' | 'rtl'
      Description
      The document's text/writing direction.
      Type
      | 'info'
      | 'success'
      | 'warning'
      | 'danger'
      | 'neutral'
      | 'loading'
      Description
      Governs the color of the notification and its icon.
      Type
      () =>
      | Node
      | ShadowRoot
      | Document
      Description
      A root node to correctly resolve document in custom environments. i.e., Iframes, Electron.
        Type
        string
        Description
        id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
        Type
        () => void
        Description
        Function invoked when the notification is dismissed
          Type
          | 'horizontal'
          | 'vertical'
          Description
          The layout of the notification's elements.
          • 'horizontal': The icon, title, description, link, and close button are displayed inline.
          • 'vertical': The icon, title, and close button are placed on the first line, while the description, and link are stacked vertically and aligned with the title.
          Type
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Description
          Allows you to replace the component's HTML element with a different tag or component. Learn more
          Type
          | 'status'
          | 'alert'
          Description
          The WAI-ARIA role of the notification.
          • 'alert': Use this role when the notification is an alert that requires the user's immediate attention, like for errors or urgent information.
          • 'status': Use this role when the notification is a status message that doesn't require the user's immediate attention, like for success or informational messages.

          <InlineNotification.Icon>

          An icon that indicates the notification's status. Renders a <span> element by default.
          PropType
          Override the icon displayed in the notification. When this prop is omitted, the icon is determined by the emphasis prop.
          | LucideIcon
          | ReactNode
          Allows you to replace the component's HTML element with a different tag or component. Learn more
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Type
          | LucideIcon
          | ReactNode
          Description
          Override the icon displayed in the notification. When this prop is omitted, the icon is determined by the emphasis prop.
          Type
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Description
          Allows you to replace the component's HTML element with a different tag or component. Learn more

          <InlineNotification.Label>

          A heading that labels the notification. Renders a <div> element by default.
          PropType
          React children prop.
          id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
          string
          Allows you to replace the component's HTML element with a different tag or component. Learn more
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Description
          React children prop.
          Type
          string
          Description
          id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
          Type
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Description
          Allows you to replace the component's HTML element with a different tag or component. Learn more

          <InlineNotification.Description>

          A paragraph with additional information about the notification. Renders a <div> element by default.
          PropType
          React children prop.
          id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
          string
          Allows you to replace the component's HTML element with a different tag or component. Learn more
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Description
          React children prop.
          Type
          string
          Description
          id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
          Type
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Description
          Allows you to replace the component's HTML element with a different tag or component. Learn more

          <InlineNotification.CloseButton>

          Closes the notification when clicked. Renders a <button> element by default.
          PropType
          React children prop.
          id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
          string
          Allows you to replace the component's HTML element with a different tag or component. Learn more
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Description
          React children prop.
          Type
          string
          Description
          id attribute. If omitted, a unique identifier will be automatically generated for accessibility.
          Type
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Description
          Allows you to replace the component's HTML element with a different tag or component. Learn more

          <InlineNotification.ActionContainer>

          A container for the notification's primary action button. Renders a <div> element by default.
          PropType
          React children prop.
          Allows you to replace the component's HTML element with a different tag or component. Learn more
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Description
          React children prop.
          Type
          | ReactElement
          | ((
          props: object,
          ) => ReactElement)
          Description
          Allows you to replace the component's HTML element with a different tag or component. Learn more