great_tables
  • Get Started
  • Examples
  • Reference
  • Blog

On this page

  • style.borders
    • Parameters
    • Returns
    • Examples
    • Attributes

style.borders

style.borders(sides='all', color='#000000', style='solid', weight='1px')

A style specification for cell borders.

The styles.borders() class is to be used with the tab_style() method, which itself allows for the setting of custom styles to one or more cells. The sides argument is where we define which borders should be modified (e.g., "left", "right", etc.). With that selection, the color, style, and weight of the selected borders can then be modified.

Parameters

sides : Literal['all', 'top', 'bottom', 'left', 'right'] | list[Literal['all', 'top', 'bottom', 'left', 'right']] = 'all'

The border sides to be modified. Options include "left", "right", "top", and "bottom". For all borders surrounding the selected cells, we can use the "all" option.

color : str | ColumnExpr = '#000000'

The border color can be defined with any valid CSS color value, such as a hex code, a named color, or an RGB value. The default color value is "#000000" (black).

style : str | ColumnExpr = 'solid'

The border style can be one of either "solid" (the default), "dashed", "dotted", "hidden", or "double".

weight : str | ColumnExpr = '1px'

The default value for weight is "1px" and higher values will become more visually prominent.

Returns

: CellStyleBorders

A CellStyleBorders object, which is used for a styles argument if specifying cell borders.

Examples

See GT.tab_style().

Attributes

Name Description
color str(object=’’) -> str
sides str(object=’’) -> str
style str(object=’’) -> str
weight str(object=’’) -> str