Attachment
Attachment shows one file with its preview, name, size and upload state. Use it in upload queues and message composers. For a general list row, use Item.
This example also needs: Button.
Installation
Run npx nxds-cli@latest init first if nxds isn’t set up in your app yet. See Install.
Usage
Composition
Examples
States
Show each upload state, from empty drop target to done.
Sizes
Compare the default and small sizes.
Grouped
Scroll several attachments sideways in an AttachmentGroup.
This example also needs:
Props
Attachment
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | "horizontal" | "vertical" | null | "horizontal" | No description |
size | "default" | "sm" | null | "default" | No description |
state | AttachmentState | "done" | Upload state. Screen readers announce in-progress and error states, and |
statusLabel | string | No default documented | Replaces the built-in status text, such as 'Uploading'. Ignored while |
AttachmentActions
AttachmentActions adds no props of its own; it accepts the props of the element or primitive it wraps.
AttachmentContent
AttachmentContent adds no props of its own; it accepts the props of the element or primitive it wraps.
AttachmentDescription
AttachmentDescription adds no props of its own; it accepts the props of the element or primitive it wraps.
AttachmentGroup
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | No default documented | No description |
aria-labelledby | string | No default documented | No description |
AttachmentMedia
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "icon" | "image" | null | "default" | No description |
AttachmentProgress
AttachmentProgress adds no props of its own; it accepts the props of the element or primitive it wraps.
AttachmentTitle
| Prop | Type | Default | Description |
|---|---|---|---|
trailing | ReactNode | No default documented | Badge or status icon after the file name. Keeps its width while the name truncates. |
AttachmentTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child element instead, such as an |
Attachment shows one file with its preview, name, size and upload state. Use it in upload queues and message composers. For a general list row, use Item.
This example also needs: Button.
Installation
Copy and paste the following code into your project.
components/attachment/Attachment.vue components/attachment/AttachmentActions.vue components/attachment/AttachmentContent.vue components/attachment/AttachmentDescription.vue components/attachment/AttachmentGroup.vue components/attachment/AttachmentMedia.vue components/attachment/AttachmentProgress.vue components/attachment/AttachmentTitle.vue components/attachment/AttachmentTrigger.vue components/attachment/index.ts Keep each file at the path shown above it.
Paths are relative to
packages/vue/src/. Keep the same folders under your@/root, and the imports between files work without edits.
Usage
Examples
States
Show each upload state, from empty drop target to done.
This example also needs: Spinner.
Sizes
Compare the default and small sizes.
Grouped
Scroll several attachments sideways in an AttachmentGroup.
Props
Attachment
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | "vertical" | "horizontal" | null | "horizontal" | No description |
size | "default" | "sm" | null | "default" | No description |
state | AttachmentState | "done" | Upload state. Screen readers announce in-progress and error states, and |
statusLabel | string | No default documented | Replaces the built-in status text, such as 'Uploading'. Ignored while |
AttachmentActions
AttachmentActions adds no props of its own; it accepts the props of the element or primitive it wraps.
AttachmentContent
AttachmentContent adds no props of its own; it accepts the props of the element or primitive it wraps.
AttachmentDescription
AttachmentDescription adds no props of its own; it accepts the props of the element or primitive it wraps.
AttachmentGroup
| Prop | Type | Default | Description |
|---|---|---|---|
ariaLabel | string | No default documented | No description |
ariaLabelledby | string | No default documented | No description |
AttachmentMedia
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "icon" | "image" | null | "default" | No description |
AttachmentProgress
AttachmentProgress adds no props of its own; it accepts the props of the element or primitive it wraps.
AttachmentTitle
AttachmentTitle adds no props of its own; it accepts the props of the element or primitive it wraps.
AttachmentTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child element instead, such as an |