With loc.spanner_labels(), we can target the cells containing the spanner labels. This is useful for applying custom styling with the tab_style() method. That method has a locations= argument and this class should be used there to perform the targeting.
Parameters
ids:SelectExpr=None
The ID values for the spanner labels to target. A list of one or more ID values is required.
A LocSpannerLabels object, which is used for a locations= argument if specifying the table’s spanner labels.
Examples
Let’s use a subset of the gtcars dataset in a new table. We create two spanner labels through two separate calls of the tab_spanner() method. In each of those, the text supplied to label= argument is used as the ID value (though they have to be explicitly set via the id= argument). We will style only the spanner label having the text "performance" by using locations=loc.spanner_labels(ids=["performance"]) within tab_style().