Angular Data Gridv32 Themes: Custom Icons

This section details how to provide your own icons for the grid and style grid icons for your application requirements

This page describes the grid's theming system from v32 and before, for the benefit of applications that have not yet migrated to the Theming API. These themes are deprecated and will be removed in a future major version. You may want to visit the new theming docs or check out the migration guide.

Swapping the Provided Icon Fonts

Each provided theme comes with its own icon font. It is simple to use one provided theme with another theme's icons. Set --ag-icon-font-family to one of: agGridQuartz, agGridAlpine, agGridBalham or agGridMaterial. You can compare the available icon fonts in the Provided Icons list.

If you are using the Sass API, it will embed the required font data for you. Apps using CSS should load the font's CSS file from whatever location they are loading ag-grid.css and other CSS files. For example to use the Material icons in the Quartz theme:

  1. Load agGridMaterialFont.css
  2. (optional) switch ag-theme-quartz.css for ag-theme-quartz-no-font.css to save a few kB if you no longer require the Quartz icons
  3. Set the CSS variable --ag-icon-font-family: agGridMaterial

This example uses the Quartz theme with icons from the Material theme:

Using Alternative Icons

Grid icons can use an icon font or images. The grid exposes a number of CSS variables to control the icons. Each variable can optionally be suffixed with the name of a specific icon, and will affect only that icon, e.g. setting --ag-icon-font-color-loading sets the color of the "loading" icon.

Icon font variables:

  • --ag-icon-font-family[-icon-name] set the icon font family.
  • --ag-icon-font-code[-icon-name] set the unicode character of the icon within the icon font, using a unicode escape sequence like "\f247".
  • --ag-icon-font-weight[-icon-name] sets the font weight, used for icon fonts that require a specific weight to work.
  • --ag-icon-font-color[-icon-name] set the color of the icon.
  • --ag-icon-font-display[-icon-name] set this to none to hide the icon font if you want to provide an image-based icon instead.

Icon image variables:

  • --ag-icon-image[-icon-name] set this to url(/path/to/icon.svg)
  • --ag-icon-image-opacity[-icon-name] set the opacity of an icon. Defaults to 0.9 if not set.
  • --ag-icon-image-display[-icon-name] set this to none to hide the icon image if you want to provide an font-based icon instead.

Other icon variables:

  • --ag-icon-size sets the height and width of icons in pixels.

Example: using an alternative icon font

This example demonstrates globally changing the icon font, and also selectively replacing individual icons:

.ag-theme-quartz {
  /* replace all icons in the grid with icons from Font Awesome */
  --ag-icon-font-family: "Font Awesome 5 Free";
  --ag-icon-font-code-aggregation: "\f247";
  --ag-icon-font-code-arrows: "\f0b2";
  --ag-icon-font-code-asc: "\f062";
  /* ... and so on - because --ag-icon-font-family sets the font for
     all icons, a new code must be provided for every one. If you only
     wanted to replace some icons, use --ag-icon-font-family-{icon-name} */

  /* selectively replace the the group icon with one from Material Design Icons */
  --ag-icon-font-family-group: "Material Design Icons";
  --ag-icon-font-code-group: "\F0328";
  --ag-icon-font-color-group: red;
  --ag-icon-font-weight-group: normal;
}

Example: SVG icons

This example demonstrates using the --ag-icon-image-icon-name variables to set SVG images for specific icons.

.ag-theme-quartz {
  /* hide all font icons */
  --ag-icon-font-display: none;
  /* provide a SVG icon */
  --ag-icon-image-aggregation: url("https://www.ag-grid.com/example-assets/svg-icons/aggregation.svg");
  --ag-icon-image-arrows: url("https://www.ag-grid.com/example-assets/svg-icons/arrows.svg");
  --ag-icon-image-asc: url("https://www.ag-grid.com/example-assets/svg-icons/asc.svg");
  /* ... and so on - because --ag-icon-font-display: none; hides all
     icons, an image must be provided for every one. If you only wanted
     to replace some icons, use --ag-icon-font-display-{icon-name} */
}

The following example replaces the grid's icons with SVG images:

Set the Icons Through gridOptions (JavaScript)

You can pass an icons property either on the Grid Options to apply across the whole grid, or the Column Definition. If both are provided, icons specified at the column level will take priority.

The icons property takes an object of name/value pairs where the name is one of the icon names below (note that these are different from the CSS names above) and the value is one of:

  • An HTML string to be inserted in place of the usual DOM element for an icon
  • A function that returns either an HTML string or a DOM node

In the following list, the name to use in the grid options is to the left, and on the right is the CSS icon name as listed in the Provided Icons table below.

// header column group shown when expanded (click to contract)
columnGroupOpened: 'expanded'
// header column group shown when contracted (click to expand)
columnGroupClosed: 'contracted'
// column tool panel column group contracted (click to expand)
columnSelectClosed: 'tree-closed',
// column tool panel column group expanded (click to contract)
columnSelectOpen: 'tree-open',
// column tool panel header expand/collapse all button, shown when some children are expanded and
//     others are collapsed
columnSelectIndeterminate: 'tree-indeterminate',
// accordion open (filter tool panel group, charts group)
accordionOpen: 'tree-open',
// accordion closed (filter tool panel group, charts group)
accordionClosed: 'tree-closed',
// accordion indeterminate - shown when some children are expanded and
//     others are collapsed (filter tool panel group, charts group)
accordionIndeterminate: 'tree-indeterminate',
// shown on drag and drop image component icon while dragging column to the side of the grid to pin
columnMovePin: 'pin'
// shown on drag and drop image component icon while dragging over part of the page that is not a drop zone
columnMoveHide: 'eye-slash'
// shown on drag and drop image component icon while dragging columns to reorder
columnMoveMove: 'arrows'
// animating icon shown when dragging a column to the right of the grid causes horizontal scrolling
columnMoveLeft: 'left'
// animating icon shown when dragging a column to the left of the grid causes horizontal scrolling
columnMoveRight: 'right'
// shown on drag and drop image component icon while dragging over Row Groups drop zone
columnMoveGroup: 'group'
// shown on drag and drop image component icon while dragging over Values drop zone
columnMoveValue: 'aggregation'
// shown on drag and drop image component icon while dragging over pivot drop zone
columnMovePivot: 'pivot'
// shown on drag and drop image component icon while dragging over drop zone that doesn't support it, e.g.
//     string column over aggregation drop zone
dropNotAllowed: 'not-allowed'
// shown on row group when contracted (click to expand)
groupContracted: 'tree-closed'
// shown on row group when expanded (click to contract)
groupExpanded: 'tree-open'
// set filter tree list group contracted (click to expand)
setFilterGroupClosed: 'tree-closed',
// set filter tree list group expanded (click to contract)
setFilterGroupOpen: 'tree-open',
// set filter tree list expand/collapse all button, shown when some children are expanded and
//     others are collapsed
setFilterGroupIndeterminate: 'tree-indeterminate',
// context menu chart item
chart: 'chart'
// dialog title bar
close: 'cross'
// X (remove) on column 'pill' after adding it to a drop zone list
cancel: 'cancel'
// indicates the currently active pin state in the "Pin column" sub-menu of the column menu
check: 'tick'
// "go to first" button in pagination controls
first: 'first'
// "go to previous" button in pagination controls
previous: 'previous'
// "go to next" button in pagination controls
next: 'next'
// "go to last" button in pagination controls
last: 'last'
// shown on top right of chart when chart is linked to range data (click to unlink)
linked: 'linked'
// shown on top right of chart when chart is not linked to range data (click to link)
unlinked: 'unlinked'
// rotating spinner shown by the loading cell renderer
groupLoading: 'loading'
// button to launch legacy column menu
menu: 'menu',
// button to launch new enterprise column menu
menuAlt: 'menu-alt',
// menu tab icon in legacy tabbed enterprise column menu
legacyMenu: 'menu'
// open filter button - header, floating filter, menu
filter: 'filter',
// filter is applied - header (legacy column menu), filter tool panel
filterActive: 'filter'
// filter tab icon in legacy tabbed enterprise column menu
filterTab: 'filter',
// filter tool panel tab
filtersToolPanel: 'filter'
// columns in menu (column chooser / columns tab)
columns: 'columns'
// column tool panel tab
columnsToolPanel: 'columns'
// button in chart regular size window title bar (click to maximise)
maximize: 'maximize'
// button in chart maximised window title bar (click to make regular size)
minimize: 'minimize'
// "Pin column" item in column header menu
menuPin: 'pin'
// "Value aggregation" column menu item (shown on numeric columns when grouping is active)"
menuValue: 'aggregation'
// "Group by {column-name}" item in column header menu
menuAddRowGroup: 'group'
// "Un-Group by {column-name}" item in column header menu
menuRemoveRowGroup: 'group'
// context menu copy item
clipboardCopy: 'copy'
// context menu cut item
clipboardCut: 'cut'
// context menu paste item
clipboardPaste: 'paste'
// identifies the pivot drop zone
pivotPanel: 'pivot'
// "Row groups" drop zone in column tool panel
rowGroupPanel: 'group'
// columns tool panel Values drop zone
valuePanel: 'aggregation'
// drag handle used to pick up draggable columns
columnDrag: 'grip'
// drag handle used to pick up draggable rows
rowDrag: 'grip'
// context menu export item
save: 'save'
// csv export
csvExport: 'csv'
// excel export
excelExport: 'excel'
// icon on select dropdowns (select cell editor, charts tool panels)
selectOpen: 'small-down',
// open icon for rich select editor
richSelectOpen: 'small-down',
// remove for rich select editor pills
richSelectRemove: 'cancel',
// icon for sub menu item
subMenuOpen: 'small-right',
// version of subMenuOpen used in RTL mode
subMenuOpenRtl: 'small-left',
// separator between column 'pills' when you add multiple columns to the header drop zone
panelDelimiter: 'small-right',
// version of panelDelimiter used in RTL mode
panelDelimiterRtl: 'small-left',
// show on column header when column is sorted ascending
sortAscending: 'asc'
// show on column header when column is sorted descending
sortDescending: 'desc'
// show on column header when column has no sort, only when enabled with gridOptions.unSortIcon=true
sortUnSort: 'none',
// Builder button in Advanced Filter
advancedFilterBuilder: 'group',
// drag handle used to pick up Advanced Filter Builder rows
advancedFilterBuilderDrag: 'grip',
// Advanced Filter Builder row validation error
advancedFilterBuilderInvalid: 'not-allowed',
// shown on Advanced Filter Builder rows to move them up
advancedFilterBuilderMoveUp: 'up',
// shown on Advanced Filter Builder rows to move them down
advancedFilterBuilderMoveDown: 'down',
// shown on Advanced Filter Builder rows to add new rows
advancedFilterBuilderAdd: 'plus',
// shown on Advanced Filter Builder rows to remove row
advancedFilterBuilderRemove: 'minus',
// shown on Advanced Filter Builder selection pills
advancedFilterBuilderSelect: 'small-down',
// icon to open charts menu
chartsMenu: 'menu-alt',
// Edit Chart menu item shown in Integrated Charts menu
chartsMenuEdit: 'chart',
// Advanced Settings menu item shown in Integrated Charts menu
chartsMenuAdvancedSettings: 'settings',
// shown in Integrated Charts menu add fields
chartsMenuAdd: 'plus',
// shown in Integrated Charts tool panel color picker
chartsColorPicker: 'small-down'
// previous in Integrated Charts settings tool panel theme switcher
chartsThemePrevious: 'previous',
// next in Integrated Charts settings tool panel theme switcher
chartsThemeNext: 'next',
// download chart
chartsDownload: 'save',

Provided Icons

Below you can see a list with all available icons for each provided theme. The name next to each icon is the CSS name, e.g. the pin icon will have the CSS class ag-icon-pin and uses the CSS variable --ag-icon-font-code-pin.

aggregation

aggregation

arrows

arrows

asc

asc

cancel

cancel

chart

chart

checkbox-checked

checkbox-checked

checkbox-indeterminate

checkbox-indeterminate

checkbox-unchecked

checkbox-unchecked

color-picker

color-picker

columns

columns

contracted

contracted

copy

copy

cut

cut

cross

cross

csv

csv

desc

desc

down

down

excel

excel

expanded

expanded

eye-slash

eye-slash

eye

eye

filter

filter

first

first

grip

grip

group

group

last

last

left

left

linked

linked

loading

loading

maximize

maximize

menu

menu

menu-alt

menu-alt

minimize

minimize

minus

minus

next

next

none

none

not-allowed

not-allowed

paste

paste

pin

pin

pivot

pivot

plus

plus

previous

previous

radio-button-off

radio-button-off

radio-button-on

radio-button-on

right

right

save

save

small-down

small-down

small-left

small-left

small-right

small-right

small-up

small-up

tick

tick

tree-closed

tree-closed

tree-indeterminate

tree-indeterminate

tree-open

tree-open

unlinked

unlinked

up

up