@hanzo/ui

Sources

import { Sources, SourceCard } from '@hanzo/ui/chat'

No examples yet.

Types

export interface Source {
  id: string
  /** Accessible name and tooltip — a title, repo or file path. */
  title: string
  /** Opened on press. Surfaces without navigation can omit it. */
  href?: string
  /** Favicon or mark. Falls back to the first letter of `host` or `title`. */
  icon?: ReactNode
  /**
   * Who published it — `nytimes.com`, a repo, a filename.
   *
   * Derived by the surface: a `new URL()` here would be wrong for a source that
   * is a file path rather than a link.
   */
  host?: string
}
export interface SourcesProps extends Omit<ComponentProps<typeof YStack>, 'children'> {
  sources: Source[]
  title?: string
  /** Raised on press. Given `href`, a surface may navigate instead. */
  onOpen?: (source: Source) => void
}
export interface SourceCardProps extends Omit<ComponentProps<typeof YStack>, 'children' | 'role'> {
  source: Source
  /** Position in the list, 1-based — the number the prose's marker refers to. */
  index?: number
  onOpen?: (source: Source) => void
}

Exports

SourcesSourceCardtype Sourcetype SourcesPropstype SourceCardProps