I am unable to find any predefined classes which are supported in SharePoint JSON formatting for your requirements.
For list/table view you can use additionalRowClass
to apply additional classes without loosing list/table view and SharePoint default functionalities like context menu.
For example (I found these classes only to apply border to list/table view)
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "dropHintlineBottom"
}
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "sp-field-borderTopBottomDotted"
}
You can find supported predefined classes at:
- Predefined classes - Microsoft official documentation
- SharePoint Online CSS Classes - list of classes collected by Denis Molodtsov - few classes like
sp-field-borderBottomDotted
did not work for me.
Possible solutions you can try:
- Find predefined class which meets your requirements and use in above JSON
- Format complete view using JSON to create custom list/table view as shown here - it will remove all SharePoint OOTB functionalities.
- Create custom CSS class with required CSS, add it to all modern pages using SPFx application customizer and then use that class in your JSON