跳至正文

Attachment 附件 ​

展示附件的文件名、类型和处理状态。可点击整条附件打开预览。

import { SAttachment } from '@icecreamqaq/shadcn/attachment'

使用示例 ​

基础用法

常用 API ​

成员类型用法
SAttachment.state"idle" | "uploading" | "processing" | "error" | "done"根据业务状态改变边框和标题样式,默认为 done。
SAttachment.size"default" | "sm" | "xs"控制附件行和预览媒体的尺寸。
SAttachment.orientation"horizontal" | "vertical"默认为横向,纵向适用于缩略图。
SAttachmentTrigger.asPrimitiveProps["as"]默认渲染覆盖附件区域的 button。用可访问名称说明打开的内容。

完整 API ​

Attachment5 个成员

属性

名称类型
size"default" | "xs" | "sm" | null
orientation"vertical" | "horizontal" | null
state"done" | "idle" | "uploading" | "processing" | "error"
classClassValue

插槽

名称类型
default((props: {}) => any)
AttachmentAction6 个成员

属性

名称类型
classClassValue
variant"default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null
size"default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null
asChildboolean
asAsTag | Component

插槽

名称类型
default((props: {}) => any)
AttachmentActions2 个成员

属性

名称类型
classClassValue

插槽

名称类型
default((props: {}) => any)
AttachmentContent2 个成员

属性

名称类型
classClassValue

插槽

名称类型
default((props: {}) => any)
AttachmentDescription2 个成员

属性

名称类型
classClassValue

插槽

名称类型
default((props: {}) => any)
AttachmentGroup2 个成员

属性

名称类型
classClassValue

插槽

名称类型
default((props: {}) => any)
AttachmentMedia3 个成员

属性

名称类型
classClassValue
variant"icon" | "image" | null

插槽

名称类型
default((props: {}) => any)
AttachmentTitle2 个成员

属性

名称类型
classClassValue

插槽

名称类型
default((props: {}) => any)
AttachmentTrigger4 个成员

属性

名称类型
classClassValue
asChildboolean
asAsTag | Component

插槽

名称类型
default((props: {}) => any)

分组导出 ​

模板标签为 <s-attachment>。

组件 SAttachment、SAttachmentAction、SAttachmentActions、SAttachmentContent、SAttachmentDescription、SAttachmentGroup、SAttachmentMedia、SAttachmentTitle、SAttachmentTrigger

函数与常量 attachmentMediaVariants、attachmentVariants

类型 AttachmentMediaVariants、AttachmentVariants