Skip to content

Commit 73ac4ee

Browse files
Merge pull request SharePoint#7744 from shagra-ms/shagra/docs-update-filepreview
Formatting docs update - filepreview
2 parents fa93461 + e8d8859 commit 73ac4ee

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

docs/declarative-customization/formatting-syntax-reference.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Formatting syntax reference
33
description: Formatting syntax reference
4-
ms.date: 02/09/2022
4+
ms.date: 02/22/2022
55
ms.localizationpriority: high
66
---
77

@@ -19,9 +19,22 @@ Specifies the type of element to create. Valid elements include:
1919
- path
2020
- button
2121
- p
22+
- [filepreview](#filepreview)
2223

2324
Any other value will result in an error.
2425

26+
### filepreview
27+
28+
Use the special elmType `filepreview` in conjunction with the `src` attribute set to [`@thumbnail.<Size>`](#thumbnails) to view thumbnails for files in your document libary.
29+
If the thumbnail loads successfully, a small [brand type icon](https://developer.microsoft.com/en-us/fluentui#/styles/web/office-brand-icons) is visible on the bottom left. If the thumbanil fails to load (or if the file type doesn't support thumbnails), a [file type icon](https://developer.microsoft.com/en-us/fluentui#/styles/web/file-type-icons) is shown instead.
30+
31+
```json
32+
"elmType": "filepreview",
33+
"attributes": {
34+
"src": "@thumbnail.medium"
35+
}
36+
```
37+
2538
## txtContent
2639

2740
An optional property that specifies the text content of the element specified by `elmType`. The value of this property can either be a string (including special strings) or an Expression object.
@@ -384,6 +397,30 @@ Adds the field editor for the referenced column.
384397
"txtContent": "[$FieldName]"
385398
}
386399
```
400+
## filePreviewProps
401+
402+
An optional property, that allows overriding the default styles of file type icon and brand type icon in `filepreview` elmType.
403+
404+
- `fileTypeIconClass` and `brandTypeIconClass` can be used to provide CSS class names to the file type icon and the brand type icon elements respectively.
405+
406+
- `fileTypeIconStyle` and `brandTypeIconStyle` can be used to provide [styles](#style) to the file type icon and the brand type icon respectively. These styles will take precedence over the same styles coming from the CSS classes provided by the above 2 properties.
407+
408+
```json
409+
"elmType": "filepreview",
410+
"attributes": {
411+
"src": "@thumbnail.medium",
412+
},
413+
"filePreviewProps": {
414+
"fileTypeIconClass": "sp-css-borderColor-neutralLight",
415+
"fileTypeIconStyle": {
416+
"width": "100px"
417+
},
418+
"brandTypeIconClass": "sp-css-borderColor-neutralLight",
419+
"brandTypeIconStyle": {
420+
"width": "68px"
421+
}
422+
}
423+
```
387424

388425
## Expressions
389426

0 commit comments

Comments
 (0)