Attachments
import { Attachments } from '@hanzo/ui/agents'
Default
A file, a picked element and an upload, each removable before the turn is sent.
- src/app.tsx
- <button> .cta
- hero.png
export function Default() {const [items, setItems] = useState<Attachment[]>([{ id: 'f', kind: 'file', label: 'src/app.tsx' },{ id: 'e', kind: 'element', label: '<button> .cta' },{ id: 'u', kind: 'upload', label: 'hero.png' },])return <Attachments items={items} onRemove={(id) => setItems((all) => all.filter((i) => i.id !== id))} />}
Types
export interface Attachment {id: string/** A repo file, a picked element, an uploaded file. */kind: 'file' | 'element' | 'upload'/** What the chip says: a path, `<button> .cta`, a file name. */label: string}
export interface AttachmentsProps extends Row {items: readonly Attachment[]/** Omit and the chips cannot be removed. */onRemove?: (id: string) => void}
Exports
Attachmentstype Attachmenttype AttachmentsProps