Skip to Content
Hashti Design System
Components

Inline Notification

Contextual feedback message rendered directly alongside relevant content or forms.

Inline Notification

Inline Notifications display contextual, non-disruptive feedback directly embedded within a workflow—such as next to form inputs, table headers, or inside configuration cards.

Unlike floating toasts or assertive alerts, inline notifications stay in place alongside the content they describe, allowing users to reference guidance or error messages without losing their spatial context.

Inline NotificationLocalized feedback banners with semantic color accents.
Configuration Saved
High Thermal Delta

Import

import { InlineNotification, ActionableNotification } from "@hashti/react";

Examples

Basic Inline Notifications

Render contextual messages across four semantic kinds: info, success, warning, and error.

import { InlineNotification } from "@hashti/react";

export function BasicInlineExample() {
  return (
    <div className="space-y-4">
      <InlineNotification kind="info" title="Form auto-save is enabled.">
        Drafts are securely persisted to local storage every 30 seconds.
      </InlineNotification>

      <InlineNotification kind="success" title="API key generated successfully.">
        Store this key safely; it cannot be retrieved again after leaving this page.
      </InlineNotification>

      <InlineNotification kind="warning" title="Deprecated API version detected.">
        GraphQL v1 schemas will reach end-of-life on December 31st.
      </InlineNotification>

      <InlineNotification kind="error" title="Invalid IP Range.">
        The CIDR block provided overlaps with an existing subnet in this VPC.
      </InlineNotification>
    </div>
  );
}

Dismissible Notifications

Pass an onDismiss handler to allow users to close the notification once read:

import { useState } from "react";
import { InlineNotification, Button } from "@hashti/react";

export function DismissibleInlineExample() {
  const [visible, setVisible] = useState(true);

  if (!visible) {
    return (
      <Button variant="ghost" size="sm" onPress={() => setVisible(true)}>
        Show notification again
      </Button>
    );
  }

  return (
    <InlineNotification
      kind="info"
      title="Tips for optimal performance"
      onDismiss={() => setVisible(false)}
    >
      Compress static assets before uploading to edge buckets for faster global latency.
    </InlineNotification>
  );
}

Low vs. High Contrast

By default, inline notifications use low contrast (lowContrast={true} or variant="subtle"), providing a soft, unobtrusive visual tone that blends harmoniously into dense enterprise dashboards. Set lowContrast={false} for higher urgency:

import { InlineNotification } from "@hashti/react";

export function ContrastComparisonExample() {
  return (
    <div className="space-y-4">
      {/* Low contrast (default subtle styling) */}
      <InlineNotification kind="warning" lowContrast={true} title="Low Contrast (Subtle)">
        Recommended for routine status updates and secondary warnings.
      </InlineNotification>

      {/* High contrast (solid vibrant styling) */}
      <InlineNotification kind="warning" lowContrast={false} title="High Contrast (Solid)">
        Recommended for persistent blockers or required administrative actions.
      </InlineNotification>
    </div>
  );
}

Actionable Notification

When an inline notification requires explicit user intervention, use <ActionableNotification>. It features dedicated action slots, manages keyboard focus into the primary action, and implements an accessible role="alertdialog".

import { ActionableNotification, Button } from "@hashti/react";

export function ActionableNotificationExample() {
  return (
    <ActionableNotification
      kind="error"
      title="Session expired"
      action={
        <Button variant="primary" size="sm">
          Log In Again
        </Button>
      }
      onDismiss={() => console.log("Dismissed")}
    >
      Your credentials have timed out due to 15 minutes of inactivity.
    </ActionableNotification>
  );
}

Props Reference

InlineNotification Props

PropTypeDefaultDescription
titleReactNodeRequiredThe primary headline of the message.
childrenReactNode—Explanatory description text or rich elements rendered below the title.
kind'info' | 'success' | 'warning' | 'error''info'Semantic message kind dictating the icon and color palette.
onDismiss() => void—Callback fired when the user clicks the close button. If omitted, no close button is rendered.
lowContrastbooleantrueWhether to display the notification with soft subtle background tints.
variant'subtle' | 'solid' | 'bordered''subtle'Visual styling variant.
actionReactNode—Optional secondary buttons or interactive elements rendered inline.
rolestring'status'ARIA role applied to the container. Defaults to 'status' for polite screen reader announcements.
classNamestring—Additional CSS class names.

ActionableNotification Props

PropTypeDefaultDescription
titleReactNodeRequiredThe bold heading describing the required action.
actionReactNodeRequiredThe primary action button or interactive element.
childrenReactNode—Contextual details or consequences of the action.
kind'info' | 'success' | 'warning' | 'error''info'Semantic severity of the actionable prompt.
onDismiss() => void—Callback fired when the notification is dismissed.
autoFocusActionbooleantrueWhether to automatically move focus to the first button inside action on mount.
closeButtonLabelstring'Dismiss notification'Accessible label for the close button.

Accessibility (a11y)

  • Polite Live Region: Unlike Alert, InlineNotification uses role="status" by default. This translates to aria-live="polite", waiting until the screen reader finishes announcing the current word or task before reading the message.
  • Focus Management: For routine inline notifications, user focus is not abruptly shifted to the message, avoiding disorienting keyboard users while they type in adjacent fields.
  • Actionable Notification Alertdialog: When using <ActionableNotification>, the container uses role="alertdialog" with aria-labelledby and aria-describedby automatically pointing to the title and description IDs. Focus is safely delegated to the action button when autoFocusAction is enabled.
  • Icon Hiding: Informational icons are accompanied by the strong headline and appropriate ARIA roles so that meaning is never conveyed by color alone (WCAG 1.4.1).

Keyboard Interactions

KeyAction
TabFocuses action or close button inside notification.
Enter / SpaceActivates action or dismisses notification.

WAI-ARIA & Data Attributes

AttributeTargetDescription
[data-hovered]Close ButtonPresent on pointer hover.
[data-focused]Close ButtonPresent on keyboard focus.