Advanced Table

Styling

Collapsible Trail


collapsibleTrail is an optional prop that is set to 'true' by default. If set to 'false', it will remove the trail on the left of the rows when subRows are toggled open.

Row Styling


The rowStyling prop can be used in conjunction with row ids to control certain styling options on individual rows. It is an object that has several optional key/value pairs, this doc example highlights the following:

  • backgroundColor : use this to control the background color of the row
  • fontColor: use this to control font color for each row if needed, for example if using a darker background color.
  • expandButtonColor: use this to control the color of the expand icon if needed, for example if using a darker background color.

NOTE: Each object within the tableData Array must contain a unique id in order to attach an id to all Rows for this to function.

Padding Control using Row Styling


rowStyling can also be used to control padding on all cells in a given row via the use of the cellPadding key/value pair as shown here. cellPadding lets you use 'xxs', 'xs', 'sm', 'md', 'lg', 'xl' and 'none'.

Column Styling


The columnStyling prop is an optional item that can be used within columnDefinitions as shown in the code snippet below. It is an object that has several optional key/value pairs, this doc example highlights the following:

1) headerAlignment: This will allow you to control alignment of header content which is set to right aligned by default. you can set this to left, right or center.

2) cellAlignment: This will allow you to control alignment of content within all cells in the given column. This is set to right aligned by default. you can set this to left, right or center.

3) fontColor: This will allow you to control the font color for a given column.

columnStyling can be used within the columnDefinition of all the columns or some of them, as shown. Each column has its own individual control in this way.

Column Styling with Multiple Headers


columnStyling can also be used with the multi column logic. When used in this way, columnStyling must be used within the leaf column's columnDefinition as shown.

Column Styling Background Color


The columnStyling prop can also be used to set background color for entire columns.As stated above, columnStyling is an object that has several optional key/value pairs, here are the options highlighted in this doc:

1) cellBackgroundColor: use this to control the background color of all cells in the given column
2) headerBackgroundColor: use this to control the background color of the column header
3) fontColor: use this to control font color for all cells in the given column if needed, for example if using a darker background color.
4) headerFontColor: use this to control font color for the header in the given column if needed, for example if using a darker background color.

Column Styling Background Color (Custom)


cellBackgroundColor and fontColor can also accept functions for conditional styling based on row data. The function receives the row object and returns a color value.

See the code snippet below for more details.

Column Styling Background Color with Multiple Headers


The columnStyling prop can also be used to set background color for entire columns for the multi header variant as well.

It should be noted that headerFontColor and headerBackgroundColor in the multi header variant will only apply to the immediate header for the given column as shown here.

Padding Control using Column Styling


columnStyling can also be used to control padding on all cells in a given column via the use of the cellPadding key/value pair. cellPadding lets you use 'xxs', 'xs', 'sm', 'md', 'lg', 'xl' and 'none'.

This control can be used in conjunction with the customRenderer item within each columnDefinition to achieve custom background colors for individual cells as seen here. Use fontColor to achieve better contrast between cell content and background for darker backgrounds.

Column Group Border Color


The borders of column groups can be set to a different color using the columnGroupBorderColor prop. In order for these borders to be visible, this prop must be used with tableProps and verticalBorder set to true.

The available colors for the border are Playbook's Text Colors, which can be found here.


Available Props