Back to view formats
View formattingSharePoint Online

Image Slider

This sample includes format to display images in Lists as slider moving to next clicking the icon on top left of image.

Image Slider formatting preview
Sample preview · View original animation

Copy. Apply. Make it yours.

Get this format

1 definition

Review the requirements below, then paste this JSON into the matching formatting panel. Show me where.

Use your list's internal column names and replace any tenant-specific URLs or flow IDs. Formatting is presentation, not a way to secure data.

View formatting
Download JSON
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "hideColumnHeader": true,
  "hideSelection": true,
  "rowFormatter": {
    "elmType": "div",
    "children": [
      {
        "elmType": "img",
        "style": {
          "max-width": "100%"
        },
        "attributes": {
          "src": "[$url]"
        }
      },
      {
        "elmType": "div",
        "attributes": {
          "iconName": "ChevronRightEnd6",
          "class": "ms-fontColor-themePrimary--hover ms-fontSize-24 ms-fontColor-white"
        },
        "style": {
          "top": "10px",
          "left": "10px",
          "position": "absolute",
          "cursor": "pointer"
        },
        "customRowAction": {
          "action": "setValue",
          "actionInput": {
            "UpdateState": "=Number(@now)"
          }
        }
      }
    ]
  }
}

From the contributor

How to use this sample

Summary

This sample display images as a slider with navigation to the next image.

screenshot of the sample

The image to display is determined by the UpdateState column where the order to display is stored. This is updated by the format for All users.

View requirements

  • The format expect the following fields:
Field Type
Title Single line of text
url Single line of text - url of image
UpdateState Single line of text - this field will be used order the images

Edit View requirements

  • Sort: sort by UpdateState in ascending order
  • Item Limit: Edit the view and set "Number of items to display" to 1 and check option "Limit the total number of items returned to the specified amount."

Sample

Solution Author(s)
image-slider.json André Lage

Version history

Version Date Comments
1.0 December 08, 2021 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.