Blocks / File details

File details

Who has access, the properties, the versions and the activity of a file or folder.

import { FileDetails, VersionList } from "@forgeron/ui";
/01 → Default
import { FileDetails } from "@forgeron/ui";

export default function Default() {
  return (
    <div style={{ width: 320 }}>
      <FileDetails
        name="Dock plan.pdf"
        size={240_000}
        owner="Léa Martin"
        location="Operations › Lyon depot"
        modified="Nov 18, 2026 · 09:12"
        created="Oct 3, 2026 · 10:40"
        access={{
          people: ["Léa Martin", "Tom Garnier", "Camille Roy"],
          scope: "organization",
          summary: "Anyone at Atelier Moreau can view",
          onManage: () => {},
        }}
      />
    </div>
  );
}
/02 → Versions and activity
// The Versions tab restores an older version as a new one; the Activity tab takes any timeline.
import { AuditLog, FileDetails, type FileVersion } from "@forgeron/ui";
import { useState } from "react";

export default function VersionsAndActivity() {
  const [versions, setVersions] = useState<FileVersion[]>([
    {
      id: "v3",
      label: "v3",
      at: "Nov 18, 2026 · 09:12",
      by: "Léa Martin",
      size: 240_000,
      note: "Dock 3 lane",
    },
    { id: "v2", label: "v2", at: "Nov 9, 2026 · 17:30", by: "Tom Garnier", size: 236_000 },
    {
      id: "v1",
      label: "v1",
      at: "Oct 3, 2026 · 10:40",
      by: "Léa Martin",
      size: 198_000,
      note: "Uploaded",
    },
  ]);
  const restore = (id: string) => {
    const old = versions.find((v) => v.id === id)!;
    const n = versions.length + 1;
    setVersions([
      {
        id: `v${n}`,
        label: `v${n}`,
        at: "Nov 18, 2026 · 11:02",
        by: "Camille Roy",
        size: old.size,
        note: `Restored from ${old.label}`,
      },
      ...versions,
    ]);
  };
  return (
    <div style={{ width: 360 }}>
      <FileDetails
        name="Dock plan.pdf"
        size={versions[0]!.size}
        defaultTab="versions"
        versions={versions}
        retention="Old versions are kept 30 days after a replace."
        onRestoreVersion={restore}
        onDownloadVersion={() => {}}
        onUploadVersion={() => {}}
        onClose={() => {}}
        activity={
          <AuditLog
            today="2026-11-18"
            events={[
              {
                id: "e2",
                at: "2026-11-18 09:12",
                actor: "Léa Martin",
                action: "uploaded",
                target: "v3",
              },
              {
                id: "e1",
                at: "2026-11-09 17:30",
                actor: "Tom Garnier",
                action: "shared with",
                target: "Operations",
              },
            ]}
          />
        }
      />
    </div>
  );
}
API → Props
PropTypeDefaultDescription
namestring—The title.
kindFileKindfileKindOf(name)folder, pdf, image, sheet, doc, text, slides, video, audio, archive, code, other.
size / contents / owner / location / modified / creatednumber; string; string; ReactNode; string; string—The rows of the details, in this order; dates already written.
fields{ label, value }[]—More rows after them.
access{ people, scope?, summary?, onManage? }—Names with access, how far it is open (restricted, organization, link) and the Manage button.
versions{ id, label, at, by, size?, note? }[]—Newest first: the Versions tab. VersionList is the same list on its own.
onRestoreVersion / onDownloadVersion / onUploadVersion(id) => void; () => void—The buttons of the versions; leave out on a read-only file.
activityReactNode—The Activity tab: AuditLog, Activity.
tab / defaultTab / onTabChange"details" | "versions" | "activity"—The tab shown.
onClose() => void—An × in the header.
classNamestring—Extra classes.