How to Create a Button Inside a SharePoint List

How to Create a Button Inside a SharePoint List

SharePoint Online provides powerful list customization capabilities through JSON column formatting. One popular requirement is creating buttons directly inside SharePoint Lists that allow users to perform actions such as opening URLs, launching forms, triggering workflows, or navigating to related records.

Using JSON formatting, you can transform a standard column into an interactive button without writing custom code or deploying SharePoint Framework solutions.

Why Create Buttons in SharePoint Lists?

Create a Button Using JSON Formatting

Apply the following JSON formatting to a SharePoint column:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Open",
  "style": {
    "background-color": "#0078d4",
    "color": "white",
    "border": "none",
    "padding": "6px 12px",
    "border-radius": "4px"
  },
  "customRowAction": {
    "action": "defaultClick"
  }
}

This creates a clickable button inside each row of the SharePoint List.

Open a URL from a Button

You can also configure the button to open a URL stored in a column.

{
  "elmType": "a",
  "txtContent": "View",
  "attributes": {
      "target": "_blank",
      "href": "[$Website]"
  }
}

Customize Button Appearance

JSON formatting allows you to customize colors, fonts, borders, and icons.

"style": {
   "background-color": "#107c10",
   "color": "white",
   "font-weight": "bold"
}
Important: JSON column formatting is supported only in modern SharePoint experiences and requires appropriate list permissions.

How to Apply JSON Formatting

  1. Open your SharePoint List.
  2. Select the target column.
  3. Click Column Settings.
  4. Select Format This Column.
  5. Choose Advanced Mode.
  6. Paste the JSON code.
  7. Save the changes.

Common Use Cases

Best Practices

Key Takeaways