Parts contain the CSS styles for a single feature like icons or text inputs.
Using parts you can, for example, select a text input style that matches you application, or disable our provided text input styles so that you can write your own.
Configuring Theme Parts
To add a part to a theme, call the theme.withPart(...)
method which returns a new theme using that part. A theme can only have one part for a given feature, so for example because all color scheme parts have feature: "colorScheme"
, adding a new color scheme to a theme will remove any existing part.
import { themeQuartz, colorSchemeDark, iconSetMaterial } from 'ag-grid-community';
// withPart() returns a new theme and calls can be chained
const myTheme = themeQuartz
.withPart(iconSetMaterial)
.withPart(colorSchemeDark);
This example demonstrates mixing and matching any built-in theme, icon set, and color scheme:
Parts Reference
The following parts are available:
colorScheme
feature:colorSchemeLight
- neutral light schemecolorSchemeLightCold
- light scheme with subtle cold tint used by Balham themecolorSchemeLightWarm
- light scheme with subtle warm tintcolorSchemeDark
- neutral dark schemecolorSchemeDarkBlue
- our preferred dark scheme used on this websitecolorSchemeDarkWarm
- dark scheme with subtle warm tint
iconSet
feature:iconSetQuartz
- our default icon seticonSetQuartz({strokeWidth: number})
you can call iconSetQuartz as a function to provide a custom stroke width in pixels (the default is 1.5)iconSetQuartzLight
andiconSetQuartzBold
preset lighter and bolder versions of the Quartz icons with 1px and 2px stroke widths respectively.
iconSetMaterial
- the Material Design icon seticonSetAlpine
- the icon set used by the Alpine themeiconSetBalham
- the icon set used by the Balham theme
buttonStyle
feature:buttonStyleBase
- unstyled buttons with many parameters to configure their appearancebuttonStyleQuartz
- buttons styled as per the Quartz themebuttonStyleAlpine
- buttons styled as per the Alpine themebuttonStyleBalham
- buttons styled as per the Balham theme
columnDropStyle
feature - controls the styling of column drop zone in the columns tool panel:columnDropStylePlain
- undecorated drop zone as used by Balham and Material themescolumnDropStyleBordered
- drop zone with a dashed border around it as used by the Quartz and Alpine themes.
checkboxStyle
feature:checkboxStyleDefault
- checkbox style used by our themes. There is only one style provided which is configurable through parameters. It being a part allows you to replace it with your own checkbox styles if desired.
inputStyle
feature:inputStyleBase
- unstyled inputs with many parameters to configure their appearanceinputStyleBordered
- inputs with a border around theminputStyleUnderlined
- inputs with a line underneath them as used in Material Design
tabStyle
feature:tabStyleBase
- unstyled tabs with many parameters to configure their appearancetabStyleQuartz
- tabs styled as per the Quartz themetabStyleMaterial
- tabs styled as per the Material themetabStyleAlpine
- tabs styled as per the Alpine themetabStyleRolodex
- tabs designed to imitate paper cards, as used by the Balham theme
styleMaterial
feature (used by the Material theme):styleMaterial
- Adds theprimaryColor
parameter defined by Material Design v2 and uses this color instead of theaccentColor
for most colored elements.accentColor
is still used for checked checkboxes and to highlight active filters. This part also applies some adjustments to appearance of elements to match the Material Design specification, e.g. making all button text uppercase.
Removing a Part
To remove a part from a theme, call theme.withoutPart(featureName)
, which returns a new theme without the specified part:
const myCustomTheme = themeQuartz.withoutPart('checkboxStyle');
After removing the built-in part, this example uses CSS in a separate style sheet to style the checkboxes:
The above example uses an empty part to disable the default checkbox styles and adds its own checkbox styles in the application style sheet. If you want to distribute the checkbox style as a library, you can add the new styles to the part itself, see Distributing Shared Themes & Parts.