Back to column formats
Column formattingSharePoint Online

Display Count Up and Count Down Buttons

This sample demonstrates a button with a number increasing by one and a button with a number decreasing by one.

Display Count Up and Count Down Buttons 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.

Column formatting
Download JSON
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "display": "flex",
    "flex-direction": "row",
    "align-items": "center",
    "width": "180px"
  },
  "children": [
    {
      "elmType": "div",
      "style": {
        "width": "20px",
        "height": "20px",
        "display": "flex",
        "align-items": "center",
        "justify-content": "center",
        "cursor": "pointer"
      },
      "attributes": {
        "class": "ms-bgColor-themePrimary ms-bgColor-themeDark--hover ms-fontColor-white",
        "iconName": "CalculatorSubtract"
      },
      "customRowAction": {
        "action": "setValue",
        "actionInput": {
          "NumberColumnInternalName": "= @currentField - 1"
        }
      }
    },
    {
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "font-size": "30px",
        "width": "140px",
        "text-align": "center"
      }
    },
    {
      "elmType": "div",
      "style": {
        "width": "20px",
        "height": "20px",
        "display": "flex",
        "align-items": "center",
        "justify-content": "center",
        "cursor": "pointer"
      },
      "attributes": {
        "class": "ms-bgColor-themePrimary ms-bgColor-themeDark--hover ms-fontColor-white",
        "iconName": "CalculatorAddition"
      },
      "customRowAction": {
        "action": "setValue",
        "actionInput": {
          "NumberColumnInternalName": "= @currentField + 1"
        }
      }
    }
  ]
}

From the contributor

How to use this sample

Summary

This sample demonstrates a button with a number increasing by one and a button with a number decreasing by one. Also, this sample uses the setValue of customRowAction to update the field. You need to set the actionInput to the internal name of the column to be updated.

screenshot of the sample

View requirements

This format can be applied to a Number column.

Sample

Solution Author(s)
number-countup-countdown.json Tetsuya Kawahara

Version history

Version Date Comments
1.0 November 21, 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.