Back to view formats
View formattingSharePoint Online

Property Card

This sample transforms list items into cards formatted with property listing layouts. To ensure the view functions correctly, make sure all specified columns are included. The icons are referenced from Fluent UI Icons.

Property 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": {
      "margin": "20px auto",
      "display": "flow",
      "flex-direction": "column",
      "max-width": "800px",
      "font-family": "Arial, sans-serif",
      "background-color": "#f9f9f9",
      "border-radius": "10px",
      "box-shadow": "0 2px 4px rgba(0, 0, 0, 0.1)",
      "overflow": "hidden"
    },
    "children": [
      {
        "elmType": "div",
        "style": {
          "overflow": "hidden",
          "border-top-left-radius": "10px",
          "border-top-right-radius": "10px",
          "position": "relative"
        },
        "children": [
          {
            "elmType": "img",
            "attributes": {
              "src": "[$PropertyImage]",
              "alt": "Property Image"
            },
            "style": {
              "width": "100%",
              "height": "auto",
              "border-top-left-radius": "10px",
              "border-top-right-radius": "10px"
            }
          },
          {
            "elmType": "div",
            "style": {
              "position": "absolute",
              "bottom": "0",
              "left": "0",
              "padding": "10px",
              "background-color": "rgba(0, 0, 0, 0.7)",
              "color": "white",
              "width": "100%",
              "box-sizing": "border-box"
            },
            "children": [
              {
                "elmType": "div",
                "style": {
                  "font-size": "20px",
                  "font-weight": "bold"
                },
                "txtContent": "[$Title]"
              }
            ]
          }
        ]
      },
      {
        "elmType": "div",
        "style": {
          "padding": "20px",
          "display": "flex",
          "justify-content": "space-between",
          "align-items": "center"
        },
        "children": [
          {
            "elmType": "div",
            "style": {
              "flex": "1",
              "font-size": "16px"
            },
            "children": [
              {
                "elmType": "div",
                "style": {
                  "color": "#555",
                  "margin-bottom": "5px"
                },
                "txtContent": "='Address:' + ' ' + [$StreetAddress]"
              },
              {
                "elmType": "div",
                "style": {
                  "font-size": "14px"
                },
                "txtContent": "[$Subtitle]"
              },
              {
                "elmType": "div",
                "style": {
                  "display": "flex",
                  "align-items": "center",
                  "gap": "10px",
                  "margin-top": "10px"
                },
                "children": [
                  {
                    "elmType": "div",
                    "style": {
                      "font-size": "20px",
                      "padding": "5px",
                      "border-radius": "50%",
                      "background-color": "#f9f9f9",
                      "color": "#555"
                    },
                    "attributes": {
                      "iconName": "AddHome",
                      "title": "Bedrooms"
                    }
                  },
                  {
                    "elmType": "div",
                    "style": {
                      "font-size": "14px"
                    },
                    "txtContent": "[$Bedrooms]"
                  },
                  {
                    "elmType": "div",
                    "style": {
                      "font-size": "20px",
                      "padding": "5px",
                      "border-radius": "50%",
                      "background-color": "#f9f9f9",
                      "color": "#555"
                    },
                    "attributes": {
                      "iconName": "Blur",
                      "title": "Bathrooms"
                    }
                  },
                  {
                    "elmType": "div",
                    "style": {
                      "font-size": "14px"
                    },
                    "txtContent": "[$Baths]"
                  },
                  {
                    "elmType": "div",
                    "style": {
                      "font-size": "20px",
                      "padding": "5px",
                      "border-radius": "50%",
                      "background-color": "#f9f9f9",
                      "color": "#555"
                    },
                    "attributes": {
                      "iconName": "Car",
                      "title": "Garages"
                    }
                  },
                  {
                    "elmType": "div",
                    "style": {
                      "font-size": "14px"
                    },
                    "txtContent": "[$Garages]"
                  }
                ]
              }
            ]
          },
          {
            "elmType": "div",
            "style": {
              "display": "flex",
              "flex-direction": "column",
              "align-items": "center",
              "margin-left": "20px"
            },
            "children": [
              {
                "elmType": "img",
                "style": {
                  "display": "block",
                  "height": "auto",
                  "max-height": "96px",
                  "max-width": "96px",
                  "border-radius": "50%"
                },
                "attributes": {
                  "src": "=getUserImage([$Agent.email],'m')"
                }
              },
              {
                "elmType": "div",
                "style": {
                  "font-size": "20px"
                },
                "attributes": {
                  "iconName": "=if([$Favorite],'HeartFill','Heart')"
                }
              }
            ]
          }
        ]
      }
    ]
  }
}

From the contributor

How to use this sample

Summary

This sample transforms list items into cards formatted with property listing layouts. 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

View requirements

Column Name Type
Title Single line of text
Baths Number
Bedrooms Number
Garages Number
Carports Number
Subtitle Single line of text
Agent Person or Group
PropertyImage Hyperlink or Picture
StreetAddress Single line of text
Favorite Yes/No

Sample

Solution Author(s)
property-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

None