File Preview
Last modified by Manuel Leduc on 2024/11/25 16:18
Description
The file preview extension provides UI component to display files and file properties.
User
N/A
Admin
N/A
Developer
Package name @xwiki/cristal-file-preview-ui
File Preview
- name: FilePreview
Props
import { Attachment } from "@xwiki/cristal-attachments-api";
type Props = { attachment: Attachment }
type Props = { attachment: Attachment }
Usage
<script type="ts" setup>
import { FilePreview } from "@xwiki/cristal-file-preview-ui";
const attachment = ...;
</script>
<template>
<file-preview :attachment="attachment" />
</template>
import { FilePreview } from "@xwiki/cristal-file-preview-ui";
const attachment = ...;
</script>
<template>
<file-preview :attachment="attachment" />
</template>
Display a preview of the file, or a generic "No preview available" message if the mime type of the provided attachment is not supported.
File Size
- name: FileSize
Props
FileSize
type Props = { size: number }
The size is the file size in bytes.
Usage
<script type="ts" setup>
import { FileSize } from "@xwiki/cristal-file-preview-ui";
</script>
<template>
<file-size :size="4569" />
</template>
import { FileSize } from "@xwiki/cristal-file-preview-ui";
</script>
<template>
<file-size :size="4569" />
</template>
Display the file size in human-readable way.