Files in context
Local image and video files. Retry updates the example state without uploading a document.
A responsive file list with image, audio, and video previews, file metadata, removal, and application-owned upload states.
Local image and video files. Retry updates the example state without uploading a document.
npm install @noorddev/vlak-react
Load the stylesheet once at your app root, then import the components you use.
import "@noorddev/vlak-react/css";
import { Attachment, Attachments, Button } from "@noorddev/vlak-react";Per-component imports are available at @noorddev/vlak-react/components/attachments.
npx @noorddev/vlak-cli add attachments
Adds the component and its dependencies to components/vlak/. Follow the StyleX setup to compile the source in your application.
npx shadcn add https://vlak.dev/r/attachments.json
Installs the same source through the shadcn CLI.
"use client";
import { useState } from "react";
import { Attachment, Attachments, Button } from "@noorddev/vlak-react";
export function DraftFiles() {
const [visible, setVisible] = useState(true);
return visible ? <Attachments>
<Attachment data={{ id: "brief", name: "Project brief.txt", mediaType: "text/plain", size: 342 }} onRemove={() => setVisible(false)} />
</Attachments> : <Button variant="subtle" onClick={() => setVisible(true)}>Reset file</Button>;
}See the integration example to compose these components with your application's model and data.
File metadata and native media previews, with explicit application actions.
| Prop | Type | Default | Description |
|---|---|---|---|
datarequired | AttachmentData | ||
variant | AttachmentVariant | Overrides the layout inherited from Attachments. | |
disabled | boolean | false | |
onRemove | () => void | ||
onRetry | () => void | ||
preview | ReactNode | Trusted application content replaces the automatic media preview. |
Also accepts HTMLAttributes<HTMLLIElement>.
The ref reaches HTMLLIElement.
A responsive list of application-owned files and media.
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | "Attachments" | |
variant | AttachmentVariant | "grid" |
Also accepts HTMLAttributes<HTMLUListElement>.
The ref reaches HTMLUListElement.
Creates local preview URLs and revokes them when files leave the list or the owner unmounts.
| Keys | Does |
|---|---|
| Tab | Reaches file links, native media controls, retry, and remove actions. |
| Enter, Space | Activates the focused file action or native media control. |
The same styles are available as CSS. Native HTML provides the static presentation; React or application code supplies state updates and actions.
npm install @noorddev/vlak
import "@noorddev/vlak/css";
<ul class="rs-attachments" aria-label="Attachments"><li class="rs-attachment"><div class="rs-attachment-row"><div class="rs-attachment-info"><p class="rs-attachment-name">Project brief.txt</p><p class="rs-attachment-detail">text/plain · 342 bytes</p></div></div></li></ul>