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,
- Move Copy Migrate SharePoint OneDrive files folders to different site collection location
- How to generate client id and secret to register SharePoint App with OAuth
- How to share SharePoint site or document with all users in organization
- Get-ADUser PowerShell - Get AD user details using email address
- error CAML Query containing special characters
- Access URL for SharePoint Tenant Admin Center (Online Office 365)
- Fix SharePoint Error - The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started
- SharePoint - The URL is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.
- How to delete SharePoint List Item programmatically using C#.Net
- How to Share Microsoft SharePoint Site with Users or Groups
- JSON column formatting to preview SharePoint Online file on mouse hover
- SharePoint List redirect user after submitting form NewForm.aspx
- See actual SharePoint error exception modify web.config
- SharePoint Server 2016 IT Preview Deprecated Removed features
- How to create SharePoint Document Library
- How to Get or Set SharePoint Document ID _dlc_DocId using PowerShell
- How to disable SharePoint subsite creation option for owners
- PowerShell - How to use Try Catch Finally blocks for error exception handling (Windows/SharePoint)
- SharePoint error - Your organization doesn't allow sharing with users from this domain. Please contact your IT department for help. (OSE403)
- [Solved] SharePoint Search Internal server error exception
- How to wrap column text in SharePoint Online Modern List Grid View using JSON formatting
- How to extend retiring SharePoint 2010 Workflows and continue with Office 365
- Changed AD user display name showing old name in SharePoint
- How to hide or remove quick launch left navigation from SharePoint Online Modern site page
- How to enable anonymous public access for SharePoint Online site collection, file, folder without login ?
More Posts:
- 3 Commands to stop Nginx Server - Linux
- PHP Script to Upload Images to Server - PHP
- How to create a New Project in Visual Studio Code (VS Code) - HowTos
- [Solution] Alpine Docker apt-get: not found - Docker
- Fix: zsh: command not found: aws (Mac/macOS) - AWS
- How to run React Native App using Android Studio Emulator - Android-Studio
- Take Screenshot on Mac OS X (Keyboard Shortcuts) - Mac-OS-X
- [Android Studio] How to locate code for activity_main.xml - Android-Studio