Element variables

Highcharts Grid includes a set of predefined CSS variables for theming interactive elements such as inputs and buttons used in e.g. headers, body cells, and pagination.

For table surfaces such as rows, columns, headers, and cells, see Grid variables.

Variable naming and fallback

Most element variables follow this pattern:

  1. Start from global element variables.
  2. Override with section-specific variables where needed.
  3. Fall back to global values when section variables are not defined.

Example:

.theme-elements {
--hcg-input-border-radius: 6px;
--hcg-pagination-input-border-radius: 0;
}

In this case, all inputs use 6px radius globally, while inputs in pagination are overridden to 0.

Inputs

Globals

VariableDefault ValueValid Values
--hcg-input-padding5pxpadding
--hcg-input-font-weightinheritfont-weight
--hcg-input-font-sizeinheritfont-size
--hcg-input-font-familyinheritfont-family
--hcg-input-color--hcg-colorcolor
--hcg-input-text-align--hcg-text-aligntext-align
--hcg-input-border-radius0border-radius
--hcg-input-border-width1pxborder-width
--hcg-input-border-stylesolidborder-style
--hcg-input-border-color--hcg-colorborder-color
--hcg-input-background#ffffff/#141414background
--hcg-input-hover-color--hcg-input-colorcolor
--hcg-input-hover-background--hcg-input-backgroundbackground
--hcg-input-hover-border-color--hcg-input-border-colorborder-color

Inputs inherit surrounding typography by default. That means header inputs follow header typography, body-cell inputs follow cell typography, and pagination inputs follow pagination typography unless input-specific font variables are set.

Section prefixes

Variable PrefixApplies ToFallback
--hcg-header-inputInputs inside header cellsGlobal
--hcg-cell-inputInputs inside body cellsGlobal
--hcg-pagination-inputInputs inside pagination UIGlobal

Example

.theme-inputs {
--hcg-input-font-size: 13px;
--hcg-input-padding: 8px;
--hcg-input-border-radius: 2px;
--hcg-input-border-color: #c9c9c9;
--hcg-input-hover-border-color: #8e8e8e;
--hcg-pagination-input-border-color: #676767;
}

Buttons

Globals

VariableDefault ValueValid Values
--hcg-button-padding6pxpadding
--hcg-button-font-weightinheritfont-weight
--hcg-button-font-sizeinheritfont-size
--hcg-button-font-familyinheritfont-family
--hcg-button-color#000000/#ffffffcolor
--hcg-button-border-radius0border-radius
--hcg-button-border-width1pxborder-width
--hcg-button-border-stylesolidborder-style
--hcg-button-border-color#000000/#ffffffborder-color
--hcg-button-backgroundtransparentbackground
--hcg-button-hover-color#ffffff/#000000color
--hcg-button-hover-background#000000/#ffffffbackground
--hcg-button-hover-border-color--hcg-button-border-colorborder-color
--hcg-button-selected-color#ffffff/#000000color
--hcg-button-selected-background#000000/#ffffffbackground
--hcg-button-selected-border-color--hcg-button-border-colorborder-color

Buttons inherit surrounding typography by default. That means header buttons follow header typography, body-cell buttons follow cell typography, and pagination buttons follow pagination typography unless button-specific font variables are set.

Section prefixes

Variable PrefixApplies ToFallback
--hcg-header-buttonButtons inside header cellsGlobal
--hcg-cell-buttonButtons inside body cellsGlobal
--hcg-pagination-buttonButtons inside pagination UIGlobal

Example

.theme-buttons {
--hcg-button-font-weight: 600;
--hcg-button-font-size: 13px;
--hcg-button-border-radius: 2px;
--hcg-button-padding: 5px;
--hcg-button-border-color: #d0d0d0;
--hcg-button-hover-background: #ececec;
--hcg-cell-button-selected-background: #1a7f37;
--hcg-cell-button-selected-color: #ffffff;
--hcg-pagination-button-selected-background: #000000;
--hcg-pagination-button-selected-color: #ffffff;
}

Focus ring

Globals

VariableDefault ValueValid Values
--hcg-focus-ring-color--hcg-colorcolor
--hcg-focus-ring-width2pxlength

Example

.theme-focus {
--hcg-focus-ring-color: #5b6ee1;
--hcg-focus-ring-width: 1px;
}

Summary

  1. Define global input and button variables first.
  2. Override by section using --hcg-header-*, --hcg-cell-*, and --hcg-pagination-*.
  3. Use shared focus ring variables for accessible focus styling.
  4. Combine with Grid variables for full table and element theming.