SharePoint developers can use JSON to format columns, views and customize list form.
Let us look at an example to preview the file content using a hover card, when the user moves the mouse over the file name (or any other field of your choice).
We are going to setup a new column "preview" (single line of text) and apply JSON formatting to this column.
- Navigate to your list/library.
- Select the column in view.
- Click Column settings --> Format this column.
- This will open a pane in the right section of screen 'Format preview column'.
- Copy and paste below JSON in the text box.
- Click Preview and make adjustments, if required.
- Click 'Save' once comfortable with the hover card.
SharePoint JSON column formatting
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "img",
"attributes": {
"src": "@thumbnail.medium"
},
"style": {
"display": "block",
"margin": "0 auto",
"max-height": "100px"
},
"customCardProps": {
"openOnEvent": "hover",
"isBeakVisible": true,
"formatter": {
"elmType": "img",
"attributes": {
"src": "@thumbnail.200x400"
},
"style": {
"max-height": "400px"
}
}
}
}
This is how the output will look. When user moves mouse and hover over the 'preview' column value of the file in Document Library, the hover card will popup and shows the contents of the file. You can adjust the height/width and other style parameters for the card.
Also note that we are showing a small thumbnail preview of the file in the same 'preview' column.
SharePoint file hover preview using JSON
Have Questions? Post them here!
More Posts related to SharePoint,
- error CAML Query containing special characters
- [Solved] SharePoint Illegal operation attempted on a registry key that has been marked for deletion
- Trigger Flow on selected Listitem from SharePoint view - create button with JSON column formatting
- SharePoint Excel error - The workbook cannot be opened because it contains the following features that are not supported by Excel in the browser
- Send Email with attachment using SharePoint PowerShell, SMTP server
- How to show or hide columns in SharePoint Online List Library from
- SharePoint excel error - A problem occurred while connecting to the server. If the problem continues, contact your administrator.
- How to get SharePoint Online user details from person or group column using REST API
- How to get SharePoint List Item URL using PowerShell
- How to get the SharePoint Tenant Login URL
- Special character & not working with SharePoint REST API
- How to disable SharePoint subsite creation option for owners
- Managed Metadata error - The data returned from the tagging UI was not formatted correctly
- Deploy SharePoint wsp solution package using PowerShell
- How to create classic site in SharePoint Online
- See actual SharePoint error exception modify web.config
- 'Edit Document' Requires a Windows Sharepoint Services-compatible application and Microsoft Internet Explorer 6.0 or higher
- How to enable anonymous public access for SharePoint Online site collection, file, folder without login ?
- SharePoint installation error - Setup is unable to proceed due to the following error This product requires Microsoft .Net Framework 4.5
- How to add animated Gif to SharePoint Online Page
- [Solved] SharePoint Search Internal server error exception
- How to create SharePoint Document Library
- SharePoint - Use Today's Date Time in list view filter and calculated column
- How to redirect SharePoint Site Collection to different URL
- SharePoint error cannot connect to the configuration database
More Posts:
- Android Lint app_name is not translated in af (Afrikaans) am (Amharic) ar (Arabic) bg (Bulgarian) - Android
- Unzip a Zip file from Terminal Command - HowTos
- How to update Android Studio - Android-Studio
- [Fix] TypeError: str object is not callable in Python - Python
- How to find the path of formula Installation by Brew - HowTos
- Get the Size of HTTP Response using cURL Command (Content Length) - cURL
- How to fix Microsoft Windows 10 update error 80070020 - Microsoft
- Open New Terminal Window Using Keyboard Shortcut macOS - MacOS