Skip to contents

For certain parameters, a length value is required. Examples include the setting of font sizes (e.g., in cell_text()) and thicknesses of lines (e.g., in cell_borders()). Setting a length in pixels with px() allows for an absolute definition of size as opposed to the analogous helper function pct().

Usage

px(x)

Arguments

x

the numeric value to format as a string (e.g., "12px") for some tab_options() arguments that can take values as units of pixels (e.g., table.font.size).

Value

A character vector with a single value in pixel units.

Examples

Use exibble to create a gt table. Use the px() helper to define the font size for the column labels.

exibble %>%
  gt() %>%
  tab_style(
    style = cell_text(size = px(20)),
    locations = cells_column_labels()
  )

This image of a table was generated from the first code example in the `px()` help file.

Function ID

7-3