Back to view formats
View formattingSharePoint Online

IMDb Card

This sample transforms list items into cards formatted with IMDb (Internet Movie Database) Movie listing layout. To ensure the view functions correctly, make sure all specified columns are included. The icons are referenced from Fluent UI Icons.

IMDb Card formatting preview
Sample preview · View original image

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/view-formatting.schema.json",
  "hideSelection": true,
  "hideColumnHeader": true,
  "rowFormatter": {
    "elmType": "div",
    "style": {
      "padding": "15px",
      "width": "600px",
      "border": "1px solid #ddd",
      "border-radius": "8px",
      "box-shadow": "0 4px 8px rgba(0, 0, 0, 0.1)",
      "margin-bottom": "15px",
      "overflow": "hidden",
      "position": "relative",
      "display": "flex",
      "flex-direction": "column"
    },
    "children": [
      {
        "elmType": "div",
        "style": {
          "display": "flex",
          "flex-direction": "column",
          "flex-wrap": "wrap"
        },
        "children": [
          {
            "elmType": "div",
            "style": {
              "display": "flex",
              "flex-direction": "row",
              "align-items": "center"
            },
            "children": [
              {
                "elmType": "div",
                "style": {
                  "flex": "0 0 140px",
                  "position": "relative"
                },
                "children": [
                  {
                    "elmType": "img",
                    "attributes": {
                      "src": "[$MovieImage]",
                      "alt": "Movie Poster"
                    },
                    "style": {
                      "width": "100%",
                      "height": "auto",
                      "border-radius": "8px"
                    }
                  }
                ]
              },
              {
                "elmType": "div",
                "style": {
                  "flex": "1",
                  "display": "flex",
                  "flex-direction": "column"
                },
                "children": [
                  {
                    "elmType": "div",
                    "style": {
                      "display": "flex",
                      "flex-direction": "column",
                      "flex-wrap": "wrap",
                      "align-items": "center"
                    },
                    "children": [
                      {
                        "elmType": "div",
                        "style": {
                          "background-color": "#54A72A",
                          "color": "white",
                          "padding": "2px 6px",
                          "border-radius": "4px",
                          "font-size": "16px"
                        },
                        "txtContent": "[$Title]"
                      },
                      {
                        "elmType": "div",
                        "style": {
                          "display": "flex",
                          "flex-direction": "row",
                          "flex-wrap": "wrap",
                          "margin-top": "10px"
                        },
                        "children": [
                          {
                            "elmType": "span",
                            "style": {
                              "align-items": "center",
                              "color": "rgba(0, 0, 0, 0.54)",
                              "padding": "2px 6px",
                              "font-size": "16px"
                            },
                            "txtContent": "[$Year]"
                          },
                          {
                            "elmType": "span",
                            "style": {
                              "align-items": "center",
                              "color": "rgba(0, 0, 0, 0.54)",
                              "padding": "2px 6px",
                              "font-size": "16px"
                            },
                            "txtContent": "[$Duration]"
                          },
                          {
                            "elmType": "span",
                            "style": {
                              "align-items": "center",
                              "color": "rgba(0, 0, 0, 0.54)",
                              "padding": "2px 6px",
                              "font-size": "16px"
                            },
                            "txtContent": "[$Rating]"
                          }
                        ]
                      },
                      {
                        "elmType": "div",
                        "style": {
                          "display": "flex",
                          "flex-direction": "row",
                          "flex-wrap": "wrap",
                          "margin-top": "10px"
                        },
                        "children": [
                          {
                            "elmType": "div",
                            "style": {
                              "font-size": "20px",
                              "color": "#FFCC99",
                              "margin-left": "5px"
                            },
                            "attributes": {
                              "iconName": "FavoriteStarFill"
                            }
                          },
                          {
                            "elmType": "span",
                            "style": {
                              "align-items": "center",
                              "color": "rgba(0, 0, 0, 0.54)",
                              "font-size": "16px",
                              "margin-left": "5px"
                            },
                            "txtContent": "[$VoteCount.displayValue]"
                          },
                          {
                            "elmType": "span",
                            "style": {
                              "background-color": "#54A72A",
                              "margin-left": "5px",
                              "color": "white",
                              "padding": "2px 6px",
                              "border-radius": "4px"
                            },
                            "txtContent": "[$Metascore.displayValue]"
                          },
                          {
                            "elmType": "span",
                            "style": {
                              "align-items": "center",
                              "color": "rgba(0, 0, 0, 0.54)",
                              "font-size": "16px",
                              "margin-left": "5px"
                            },
                            "txtContent": "Metascore"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "elmType": "div",
        "style": {
          "display": "flex",
          "flex-direction": "row"
        },
        "children": [
          {
            "elmType": "div",
            "style": {
              "display": "flex",
              "flex-wrap": "wrap",
              "margin-top": "10px"
            },
            "children": [
              {
                "elmType": "span",
                "style": {
                  "font-size": "16px",
                  "margin-right": "5px",
                  "font-weight": "bold"
                },
                "txtContent": "Director:"
              },
              {
                "elmType": "a",
                "attributes": {
                  "href": "<<URL of the filtered View>>"
                },
                "style": {
                  "font-size": "16px",
                  "text-decoration": "none",
                  "color": "#333",
                  "margin-right": "5px",
                  "font-style": "italic"
                },
                "txtContent": "[$Director]"
              },
              {
                "elmType": "span",
                "style": {
                  "font-size": "16px",
                  "margin-right": "5px",
                  "font-weight": "bold"
                },
                "txtContent": "Stars:"
              },
              {
                "elmType": "a",
                "attributes": {
                  "href": "<<URL of the filtered View>>"
                },
                "style": {
                  "font-size": "16px",
                  "text-decoration": "none",
                  "color": "#333",
                  "margin-right": "5px",
                  "font-style": "italic"
                },
                "txtContent": "[$Actor1]"
              },
              {
                "elmType": "a",
                "attributes": {
                  "href": "<<URL of the filtered View>>"
                },
                "style": {
                  "font-size": "16px",
                  "text-decoration": "none",
                  "color": "#333",
                  "margin-right": "5px",
                  "font-style": "italic"
                },
                "txtContent": "[$Actor2]"
              },
              {
                "elmType": "a",
                "attributes": {
                  "href": "<<URL of the filtered View>>"
                },
                "style": {
                  "font-size": "16px",
                  "text-decoration": "none",
                  "color": "#333",
                  "margin-right": "5px",
                  "font-style": "italic"
                },
                "txtContent": "[$Actor3]"
              }
            ]
          }
        ]
      }
    ]
  }
}

From the contributor

How to use this sample

Summary

This sample transforms list items into cards formatted with IMDb (Internet Movie Database) Movie listing layout. To ensure the view functions correctly, make sure all specified columns are included. The icons are referenced from Fluent UI Icons.

screenshot of the sample

The Director and Actor names are hyperlinks so that you can leverage them to filter other movies where they might have featured. If you set the href as follows, the link to the filtered view will be displayed:

"href": "=@currentWeb+'/Lists/<<ListName>>'+'/'+'<<ViewName>>.aspx?FilterField1=<<InternalNameOfColumn>>&FilterValue1='+[$<<InternalNameOfColumnToBeUsedForFilter>>]"

For example:

"href": "=@currentWeb+'/Lists/MovieCast'+'/'+'AllItems.aspx?FilterField1=Title&FilterValue1='+[$Actor1]"

screenshot of the filtered view

You can achieve that by using query strings as described in this blog.

View requirements

Column Name Type
Title Single line of text
Year Single line of text
Duration Single line of text
Rating Choice (PG,R,A)
VoteCount Number
Metascore Number
Director Single line of text
Actor1 Single line of text
Actor2 Single line of text
Actor3 Single line of text
MovieImage Hyperlink or Picture

Sample

Solution Author(s)
imdb-card.json Sudeep Ghatak

Version history

Version Date Comments
1.0 July 22, 2024 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.


Additional notes