Skip to content

Commit 7de7ddd

Browse files
Merge pull request SharePoint#9615 from arkogupta/main
Formatting docs update - April 2024
2 parents ae52e85 + 6cb37ed commit 7de7ddd

File tree

1 file changed

+36
-14
lines changed

1 file changed

+36
-14
lines changed

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

Lines changed: 36 additions & 14 deletions
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: 04/08/2023
4+
ms.date: 04/03/2024
55
ms.localizationpriority: high
66
---
77

@@ -25,15 +25,17 @@ Any other value will result in an error.
2525

2626
### filepreview
2727

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/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/fluentui#/styles/web/file-type-icons) is shown instead.
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 library.
29+
30+
If the thumbnail loads successfully, a small [brand type icon](https://developer.microsoft.com/fluentui#/styles/web/office-brand-icons) is visible on the bottom left. If the thumbnail fails to load (or if the file type doesn't support thumbnails), a [file type icon](https://developer.microsoft.com/fluentui#/styles/web/file-type-icons) is shown instead.
3031

3132
```json
3233
"elmType": "filepreview",
3334
"attributes": {
3435
"src": "@thumbnail.medium"
3536
}
3637
```
38+
3739
### img src security
3840

3941
Images from the following domains are allowed:
@@ -293,11 +295,11 @@ An optional property that is meant for debugging. It outputs error messages and
293295

294296
An optional property that allows an element to duplicate itself for each member of a specific multi-value field or an array. The value of `"forEach"` property should be in the format of either `"iteratorName in @currentField"` or `"iteratorName in [$FieldName]"` or `"iteratorName in Expression-Returning-An-Array"`.
295297

296-
`iteratorName` represents the name of iterator variable that is used to represent the current member of the multi-value field. The name of the iterator can be any combination of alphanumeric characters and underscore (`_`) that does not start with a digit.
298+
`iteratorName` represents the name of the iterator variable that is used to represent the current member of the multi-value field. The name of the iterator can be any combination of alphanumeric characters and an underscore (`_`) that does not start with a digit.
297299

298-
The field used in the loop must be in a supported field type with multi-value option enabled: Person, Lookup, and Choice. An expression returning an array can also be used.
300+
The field used in the loop must be in a supported field type with multi-value options enabled: Person, Lookup, and Choice. An expression returning an array can also be used.
299301

300-
In the element with `forEach` or its children elements, the iterator variable can be referred as if it is a new field. The index of the iterator can be accessed with `loopIndex` operator.
302+
In the element with `forEach` or its children elements, the iterator variable can be referred to as if it is a new field. The index of the iterator can be accessed with `loopIndex` operator.
301303

302304
`forEach` cannot be applied to the root element, and will render no element if there is no value in the field.
303305

@@ -366,6 +368,26 @@ See [here](./column-formatting.md#formatting-multi-value-fields) for examples.
366368
}
367369
```
368370

371+
- **embed**: Clicking on the button will open a callout with content embedded in it. The content will be determined by the URL provided in the `src` attribute in `actionInput`. You can also control the `height` and `width` of the callout using the actionInput. Note that the src has to be just the url part of an embeddable code generated by an app.\
372+
Refer to this article for more information about how to allow list domains - https://go.microsoft.com/fwlink/p/?linkid=2258033.\
373+
Note - This action is only available in the newer version of the Microsoft Lists App.
374+
375+
```JSON
376+
{
377+
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
378+
"elmType": "button",
379+
"customRowAction": {
380+
"action": "embed",
381+
"actionInput": {
382+
"src": "https://www.relecloud.com/embed/ll00hWQMJxQ",
383+
"height": "350",
384+
"width": "700"
385+
}
386+
},
387+
"txtContent": "Click here to open recipe video 👩‍🍳"
388+
}
389+
```
390+
369391
The `actionParams` attribute can have the following options when using the `executeFlow` action:
370392

371393
- **id**: ID of the Flow to launch _(required)_
@@ -374,26 +396,26 @@ The `actionParams` attribute can have the following options when using the `exec
374396

375397
## customCardProps
376398

377-
Add a custom card to the element, that shows up on hover or click event. Following customization is available -
399+
Add a custom card to the element, that shows up on hover or click event. The following customization is available -
378400

379401
- `"formatter"`: JSON object that defines formatting for custom cards.
380402
- `"openOnEvent"`: Event on which the customCard should open.
381403
- Valid values: `click`, `hover`
382-
- `"directionalHint"`: Specify the direction relative to the target in which custom card will be positioned. This is the preferred ___location but is not guaranteed depending on space.
404+
- `"directionalHint"`: Specify the direction relative to the target in which the custom card will be positioned. This is the preferred ___location but is not guaranteed depending on space.
383405
- Valid values: `bottomAutoEdge`, `bottomCenter`, `bottomLeftEdge`, `bottomRightEdge`, `leftBottomEdge`, `leftCenter`, `leftTopEdge`, `rightBottomEdge`, `rightCenter`, `rightTopEdge`, `topAutoEdge`, `topCenter`, `topLeftEdge`, `topRightEdge`
384406
- `"isBeakVisible"`: Specify if the beak is to be shown or not.
385407
- `"beakStyle"`: Specifies the style object for custom card's beak.
386408

387409
## defaultHoverField
388410

389-
Adds the profile card for the people fields or file hover card for files in document library.
411+
Adds the profile card for the people fields or file hovercard for files in the document library.
390412

391413
- `"defaultHoverField": "[$Editor]"` adds a profile card for the editor field
392414
- `"defaultHoverField": "[$FileLeafRef]"` adds a file hover card in documentLibrary
393415

394416
## columnFormatterReference
395417

396-
This will be replaced with the referenced column's formatter JSON. Multi level reference is not supported.
418+
This will be replaced with the referenced column's formatter JSON. Multi-level reference is not supported.
397419

398420
```JSON
399421
{
@@ -439,11 +461,11 @@ An optional property, that allows overriding the default styles of file type ico
439461

440462
## Expressions
441463

442-
Values for `txtContent`, style properties, and attribute properties can be expressed as expressions, so that they are evaluated at runtime based on the context of the current field (or row). Expression objects can be nested to contain other Expression objects.
464+
Values for `txtContent`, style properties, and attribute properties can be expressed as expressions so that they are evaluated at runtime based on the context of the current field (or row). Expression objects can be nested to contain other Expression objects.
443465

444466
Expressions can be written using Excel-style expressions in SharePoint Online and SharePoint Server Subscription Edition starting with the Version 22H2 feature update, or by using Abstract Syntax Tree expressions in SharePoint Online, SharePoint Server Subscription Edition, and SharePoint Server 2019.
445467

446-
All fields in ViewFields can be referred in expresisons, even if it is marked `Explicit`.
468+
All fields in ViewFields can be referred in expressions, even if it is marked `Explicit`.
447469

448470
### Excel-style expressions
449471

@@ -685,11 +707,11 @@ Operators specify the type of operation to perform. The following operators are
685707

686708
The substring() method returns the part of the string between the start and end indexes, or to the end of the string.
687709

688-
- **replace**: searches a string (or array) for a specified value and returns a new string (or array) where the specified value is replaced. Incase of string, only the first instance of the value will be replaced.
710+
- **replace**: searches a string (or array) for a specified value and returns a new string (or array) where the specified value is replaced. In case of string, only the first instance of the value will be replaced.
689711
- `"txtContent":"=replace('Hello world', 'world', 'everyone')"` results in _Hello everyone_
690712
- `"txtContent":"=replace([$MultiChoiceField], 'Choice 1', 'Choice 2')"` returns an array replacing Choice 1 with Choice 2
691713
- `"txtContent":"=replace([$MultiUserField], @me, '[email protected]')"` returns an array replacing @me with '[email protected]'
692-
- **replaceAll**: searches a string for a specified value and returns a new string (or array) where the specified value is replaced. Incase of string, all instances of the value will be replaced.
714+
- **replaceAll**: searches a string for a specified value and returns a new string (or array) where the specified value is replaced. In case of string, all instances of the value will be replaced.
693715
- `"txtContent":"=replaceAll('H-e-l-l-o W-o-r-l-d', '-', '')"` results in _Hello World_
694716
- **padStart**: pads the current string with another string until the resulting string reaches the given length. The padding is applied from the start of the current string.
695717
- `"txtContent":"=padStart('DogFood', 10, 'A')"` results in _AAADogFood_

0 commit comments

Comments
 (0)