Hi, fellow SharePoint developers and power users! 🤓
Are you working with the SharePoint Framework (SPFx), or must you style SharePoint lists with JSON formatting? Then you might want to know that there is a collection of all reusable CSS classes available on a single page: https://zerg00s.github.io/sp-modern-classes
You can use column and view formatting to customize how fields in SharePoint lists and libraries are displayed. To do this, you construct a JSON object that describes the elements that are displayed when a field is included in a list view, and the styles to be applied to those elements.
{"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json","elmType": "div","txtContent": "@currentField","attributes": {"class": "sp-field-dataBars"}}
In SPFx web parts, you can reuse the classes by using the className attribute. For example, to apply a border to a field, you can use the sp-field-borderAllDashed class:
<div className={`sp-field-dataBars sp-field-borderAllDashed`}>
I hope you find this collection of reusable CSS classes helpful. If you have any questions or suggestions, please leave a comment below. 🙏