Back to view formats
View formattingSharePoint Online

Pricing Table

This sample transforms list items into cards formatted with pricing table layouts.

screenshot of the sample
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/tile-formatting.schema.json",
  "height": "500",
  "width": "350",
  "hideSelection": true,
  "formatter": {
    "elmType": "div",
    "style": {
      "display": "flex",
      "flex-wrap": "wrap",
      "flex-grow": "1",
      "align-items": "stretch",
      "justify-content": "center",
      "margin-bottom": "15px",
      "padding": "5px"
    },
    "children": [
      {
        "elmType": "div",
        "style": {
          "position": "relative",
          "width": "95%",
          "height": "92.25%",
          "box-shadow": "rgba(0, 0, 0, 0.1) 0px 4px 12px",
          "overflow": "hidden",
          "border-radius": "2px"
        },
        "attributes": {
          "class": "ms-bgColor-white"
        },
        "children": [
          {
            "elmType": "div",
            "style": {
              "text-align": "left"
            },
            "children": [
              {
                "elmType": "div",
                "style": {
                  "height": "100px",
                  "display": "flex",
                  "align-items": "center",
                  "justify-content": "center",
                  "flex-direction": "column",
                  "background-color": "=if([$BackgroundColorCode],[$BackgroundColorCode], '')",
                  "color": "=if([$ColorCode],[$ColorCode],'')"
                },
                "attributes": {
                  "class": "ms-bgColor-themePrimary ms-fontColor-white"
                },
                "children": [
                  {
                    "elmType": "div",
                    "style": {
                      "font-size": "14px",
                      "font-weight": "600",
                      "text-transform": "uppercase",
                      "padding-top": "5px"
                    },
                    "txtContent": "[$Title]"
                  },
                  {
                    "elmType": "div",
                    "style": {
                      "display": "flex",
                      "align-items": "baseline",
                      "color": "inherit"
                    },
                    "children": [
                      {
                        "elmType": "div",
                        "style": {
                          "font-size": "20px",
                          "font-weight": "400",
                          "text-transform": "uppercase"
                        },
                        "txtContent": "[$AmountPrefix]"
                      },
                      {
                        "elmType": "div",
                        "style": {
                          "font-size": "42px",
                          "font-weight": "500",
                          "text-transform": "uppercase"
                        },
                        "txtContent": "[$Amount]"
                      },
                      {
                        "elmType": "div",
                        "style": {
                          "font-size": "14px",
                          "font-weight": "200",
                          "text-transform": "uppercase"
                        },
                        "txtContent": "[$AmountSuffix]"
                      }
                    ]
                  }
                ]
              },
              {
                "forEach": "lookupIterator in split([$Features],';')",
                "elmType": "div",
                "style": {
                  "display": "flex",
                  "align-items": "center",
                  "justify-content": "space-between",
                  "border-bottom": "1px solid #f7f7f7",
                  "padding": "10px",
                  "position": "relative"
                },
                "children": [
                  {
                    "elmType": "span",
                    "attributes": {
                      "iconName": "Completed",
                      "class": "ms-font-xl ms-fontColor-neutralTertiary"
                    },
                    "style": {
                      "padding-left": "15px",
                      "font-size": "22px",
                      "flex": "0 1 auto"
                    }
                  },
                  {
                    "elmType": "div",
                    "style": {
                      "position": "absolute",
                      "left": "50%",
                      "transform": "translate(-50%)",
                      "font-size": "16px",
                      "font-weight": "400"
                    },
                    "txtContent": "[$lookupIterator]"
                  }
                ]
              },
              {
                "elmType": "a",
                "attributes": {
                  "class": "ms-bgColor-themePrimary ms-fontColor-white",
                  "href": "[$Link]",
                  "target": "_blank"
                },
                "style": {
                  "position": "absolute",
                  "bottom": "0",
                  "display": "flex",
                  "width": "100%",
                  "height": "50px",
                  "align-items": "center",
                  "justify-content": "center",
                  "font-size": "16px",
                  "font-weight": "600",
                  "cursor": "pointer",
                  "text-decoration": "none",
                  "background-color": "=if([$BackgroundColorCode],[$BackgroundColorCode], '')",
                  "color": "=if([$ColorCode],[$ColorCode],'')"
                },
                "txtContent": "Select Package"
              }
            ]
          }
        ]
      }
    ]
  }
}
Schema compatibility review notes

This historical definition differs from the pinned Microsoft schema. This may indicate an unsupported pattern or a schema limitation. Check the original requirements and test in your tenant before use.

  • /formatter/children/0/children/0/children/1/forEach must match pattern "^[^\]\$@\. ]+ in (\@currentField|\[\$.+\])$"

From the contributor

How to use this sample

Summary

This sample transforms list items into cards formatted with pricing table layouts. To ensure the view functions correctly, make sure all specified columns are included. For the Features section in the pricing table, populate the Feature column with all the values separated by semicolons.

screenshot of the sample

screenshot of the sample embedded on the page

View requirements

Type Internal Name Required
Single line of text Title Yes
Number Amount Yes
Single line of text AmountSuffix
Single line of text AmountPrefix
Single line of text BackgroundColorCode
Single line of text ColorCode
Multiple lines of text Features
Hyperlink or Picture Link Yes
  • Make sure to use the Gallery View and include all the specified fields in the view.
  • For the Features section in the pricing table, populate the Feature column with all the values separated by semicolons.

Sample

Solution Author(s)
pricing-table.json Tanel Vahk

Version history

Version Date Comments
1.0 September 23, 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.