输入框附件
带有附件的 Composer 面板:提示上方的一条 56 像素图块、图像缩略图和带有其他所有内容文件名的插件文档图标,每个图标都位于角落。排队的文件一个接一个地落地,重音环围绕图块顺时针绘制,就像文件上传块跟踪其放置区域的方式一样,同时在角落里计算 9 像素的百分比,然后在 100 处,百分比模糊,并且在同一位置消除模糊。
主要项目海
57%

安装
已支持深色模式,此 组件 会自动使用 BoardUI 的语义设计变量。 设置主题切换.
使用共享 UI 包或自定义导入别名? 配置您的安装路径 在运行 CLI 之前。复制粘贴示例使用默认导入。
上传队列
ComposerWithAttachments 拥有队列。中的任意文件 attachments 与 progress: 0 等待轮到它,然后缩小,拉出它的环并在角落里计数;没有进度值的文件显示为立即登陆。上传是模拟的,因此块保持与后端无关:使用 uploadDuration 和 uploadGap,并聆听 onUploadComplete 和 onAllUploaded。随时添加文件;他们排在队列的最后。
const [files, setFiles] = useState<ComposerAttachment[]>([]);
function attach(picked: File[]) { setFiles((prev) => [ ...prev, ...picked.map((file) => ({ id: crypto.randomUUID(), name: file.name, kind: kindOf(file), progress: 0, // queued: lands after the ones before it })), ]);}
<ComposerWithAttachments attachments={files} onAttachmentsChange={setFiles} // dismissals come back through here uploadDuration={1100} // one simulated upload, ms uploadGap={240} // pause before the next ring starts, ms onUploadComplete={(file) => console.log("landed", file.name)} onAllUploaded={() => console.log("all landed")}/>瓷砖种类
六种。 image 用其填充瓷砖 src 并得到磨砂白色解雇;文档、电子表格、演示文稿、代码和视频类型带有添加菜单已提供的 24 像素插件图标,文件名位于下方 9 像素,被截断为图块。两者都 ComposerAttachmentStrip 和单身 ComposerAttachmentTile 导出到作曲家外部的表面。
{/* Six tile kinds: images show the thumbnail, the rest carry the plugin document icons */}<ComposerAttachmentStrip attachments={[ { id: "1", name: "cat.jpg", kind: "image", src: "/uploads/cat.jpg" }, { id: "2", name: "payroll.docx", kind: "document" }, { id: "3", name: "timetable.xlsx", kind: "spreadsheet" }, { id: "4", name: "launch.key", kind: "presentation" }, { id: "5", name: "types.tsx", kind: "code" }, { id: "6", name: "birthday.mp4", kind: "video" }, ]} onRemove={(id) => remove(id)}/>
{/* Or one tile at a time */}<ComposerAttachmentTile attachment={file} onRemove={() => remove(file.id)} />带上您自己的上传器
戒指只是一个数字。跳过队列和手 ComposerPanel 自己上传附件,将每个文件的真实传输进度映射到 progress:圆环跟随,清除该值标志着文件已落地。
{/* Real uploads: feed the ring from your own progress events on the core panel */}<ComposerPanel attachments={files.map((file) => ({ ...file, progress: uploads[file.id], // 0–100 draws the ring, undefined means landed }))} onRemoveAttachment={(id) => cancel(id)}/>