Components

SemanticSuggest

Suggestion card with type-based styling, evidence display, and accept/dismiss actions.

Category: DI Domain / Standalone

Import

import {
  SemanticSuggest,
  type SemanticSuggestProps,
  type SuggestionType,
  type SuggestionStatus,
  type SuggestionEvidence,
} from "@hareru/ui"

Exports

NameTypeDescription
SemanticSuggestComponentSuggestion card (<article>)
SemanticSuggestPropsTypeProps interface
SuggestionTypeType"add_synonym" | "add_gotcha" | "split_metric" | "update_instruction"
SuggestionStatusType"pending" | "accepted" | "rejected"
SuggestionEvidenceTypeEvidence data: queryCount, successRate, pattern

Key Props

PropTypeDefaultDescription
typeSuggestionTypeSuggestion type (required)
titlestringSuggestion title (required)
descriptionstringDetailed description
evidenceSuggestionEvidenceEvidence/rationale for the suggestion
previewstringPreview of the suggested change (rendered as <pre>)
statusSuggestionStatus"pending"Current status
confidencenumberConfidence score (0.0–1.0), shown as percentage
onAccept() => voidAccept handler
onReject() => voidReject/dismiss handler
acceptLabelstring"Accept"Accept button label
rejectLabelstring"Dismiss"Reject button label

Types

interface SuggestionEvidence {
  queryCount?: number     // Number of queries that triggered this
  successRate?: number    // 0.0–1.0
  pattern?: string        // Detected pattern description
}

Usage

import { SemanticSuggest } from "@hareru/ui"

// Pending suggestion with evidence
<SemanticSuggest
  type="add_synonym"
  title='Add "revenue" as synonym for "total_amount"'
  description="Users frequently search for 'revenue' when looking for the total_amount metric."
  evidence={{ queryCount: 42, successRate: 0.23, pattern: "revenue → total_amount" }}
  confidence={0.89}
  onAccept={() => console.log("accepted")}
  onReject={() => console.log("dismissed")}
/>

// Accepted suggestion (no action buttons)
<SemanticSuggest
  type="add_gotcha"
  title="Add gotcha: total_amount excludes refunds"
  status="accepted"
  confidence={0.95}
/>

// With preview
<SemanticSuggest
  type="update_instruction"
  title="Update metric instruction"
  preview="When users ask about 'sales', use total_amount metric filtered by order_status = 'completed'."
  status="pending"
  onAccept={() => console.log("accepted")}
  onReject={() => console.log("dismissed")}
/>

Notes

  • Type icons: + add_synonym, ! add_gotcha, / split_metric, ~ update_instruction.
  • Action buttons are only rendered when status is "pending". Accepted/rejected states show a status label instead.
  • Evidence parts are displayed as inline badges (e.g. "42 queries", "23%", pattern text).
  • Renders as an <article> with aria-label set to the title.

On this page