SourcesPreview
Collapsible source lists for response-level references.
Overview
Sources groups response references behind a compact trigger. It is useful when citations should be available without taking over the message body.
Usage
import {
Source,
Sources,
SourcesContent,
SourcesTrigger,
} from "@tilt-legal/cubitt-components/chat-elements";Examples
Default
<Sources defaultOpen>
<SourcesTrigger count={sources.length} />
<SourcesContent>
{sources.map((source) => (
<Source href={source.href} key={source.href} title={source.title} />
))}
</SourcesContent>
</Sources>Closed
<Sources>
<SourcesTrigger count={3} />
<SourcesContent>
<Source href="https://example.com/lease-review" title="Lease review memo" />
</SourcesContent>
</Sources>API Reference
Sources
Root collapsible wrapper for response sources. Extends Collapsible props.
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | - | Controlled open state inherited from Collapsible. |
defaultOpen | boolean | - | Initial open state when uncontrolled. |
onOpenChange | (open: boolean) => void | - | Callback fired when the source list opens/closes. |
className | string | - | Additional CSS classes for the root wrapper. |
SourcesTrigger
Trigger for opening and closing the source list. Extends CollapsibleTrigger props.
| Prop | Type | Default | Description |
|---|---|---|---|
count | number | - | Number used by the default label, rendered as Used {count} sources. Required. |
children | React.ReactNode | - | Custom trigger content. Replaces the default label and chevron. |
className | string | - | Additional CSS classes for the trigger. |
SourcesContent
Collapsible panel that contains Source links. Extends CollapsiblePanel props.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Source links or custom source content. |
className | string | - | Additional CSS classes for the panel. |
Source
External source link. Extends all HTML a props.
| Prop | Type | Default | Description |
|---|---|---|---|
href | string | - | Source URL. |
title | string | - | Label used by the default source content. Also maps to the anchor title attribute. |
children | React.ReactNode | - | Custom source content. Replaces the default icon/title row. |
target | string | "_blank" | Anchor target. Can be overridden through standard anchor props. |
rel | string | "noreferrer" | Anchor relationship. Can be overridden through standard anchor props. |