Skip to contents

The individual alignments of columns (which includes the column labels and all of their data cells) can be modified. We have the option to align text to the left, the center, and the right. In a less explicit manner, we can allow gt to automatically choose the alignment of each column based on the data type (with the auto option).


  align = c("auto", "left", "center", "right"),
  columns = everything()



The gt table data object

obj:<gt_tbl> --- required

This is the gt table object that is commonly created through use of the gt() function.


Alignment type

singl-kw:[auto|left|center|right] --- default: "auto"

This can be any of "center", "left", or "right" for center-, left-, or right-alignment. Alternatively, the "auto" option (the default), will automatically align values in columns according to the data type (see the Details section for specifics on which alignments are applied).


Columns to target

<column-targeting expression> --- default: everything()

The columns for which the alignment should be applied. Can either be a series of column names provided in c(), a vector of column indices, or a select helper function. Examples of select helper functions include starts_with(), ends_with(), contains(), matches(), one_of(), num_range(), and everything(). By default this is set to everything() which means that the chosen alignment affects all columns.


An object of class gt_tbl.


When you create a gt table object using gt(), automatic alignment of column labels and their data cells is performed. By default, left-alignment is applied to columns of class character, Date, or POSIXct; center-alignment is for columns of class logical, factor, or list; and right-alignment is used for the numeric and integer columns.


Use countrypops to create a gt table. Align the population column data to the left.

countrypops |>
  dplyr::select(-contains("code")) |>
  dplyr::filter(country_name == "Mongolia") |>
  tail(5) |>
  gt() |>
    align = "left",
    columns = population

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

Function ID


Function Introduced

v0.2.0.5 (March 31, 2020)