Adaptable Style Object

Summary

  • The Adaptable Style object enables all Adaptable Object that contain a style to share a common interface
  • It can comprise either a group of style-related properties or a CSS Classname to be used

There are several places in AdapTable where a custom style can be provided, including:

All of these different styles are defined using the same AdaptableStyle object.

Using Adaptable Style

The Adaptable UI makes it easy for run-time users to set an Adaptable Style.

UI Step by Step Guide

Setting an Adaptable Style in a Settings Panel Wizard

Configuring Adaptable Style

The AdaptableStyle object comprises these properties:

Hint

All the properties are optional, so set only those that differ from the current default in the grid

PropertyDescription
AlignmentAlign to Left, Right or Center
BackColorColour background of cell: hex, rgb(a) or name
BorderColorColour of cell border: hex, rgb(a) or name
BorderRadiusRounds corners of an element's outer border edge; equivalent of CSS border-radius
ClassNameExisting CSS Class; use instead of setting other object properties
FontSizeSize of font: XSmall, Small, Medium, Large or XLarge
FontStyleStyle of font: Normal or Italic
FontWeightWeight of font: Normal or Bold
ForeColorFont colour in cell: hex, rgb(a) or name
TextDecorationDecoration of font: None, Underline, Overline or LineThrough

Colour Properties

The colour related properties can be provided in 4 ways:

  • Hex Value
  • Name of the Colour (which the browser will convert)
  • RGB Value
  • RGBA Value (if transparency is required)
Adaptable Style: Color Picker
Fork
  • In this demo we have set the colours for the Quick Search Matching Cell Style in 3 different ways:
    • ForeColor used Hex value of #765341'
    • BackColor used 'hard-coded' value of 'LightGreen'
    • BorderColor used rgba value of 39, 69, 245, 0.8 (though rgb can also be used)

Expand to see the Colours

Try It Out

Run different searches and see the style applied

Colour Palette

AdapTable displays a Color Picker when users need to select colours in an Adaptable Style.

By default this contains a set of colours that AdapTable provides.

Deep Dive

Default colours in the Colour Picker

Developers can use the colorPalette property in User Interface Options to provide an alternative colour set.

colorPalette

string[]
Allows users to define their own colours to be used in the Colour Picker when creating an Adaptable Style

Note

The property can either provide a list of Hex values or a function that returns a list of Hex values

Adaptable Style: Custom Palette
Fork
  • In this demo we have provided a custom set of colours to be used in the color palette

Expand to see the Colour Palette Provided

Try It Out
  • Create a new Format Column
  • In the Style Selection open the dropdown for the 3 Colour properties

AdapTable Colour Picker

(Recorded with AdapTable v13.1)

CSS Class Option

The ClassName property references an pre-existing CSS style class which, when specified, is applied to the corresponding grid cell in AG Grid.

DO more here as commonly mentioned.

Hint

If the classname is provided in the styleClassNames property of User Interface Options, the available CSS style classes will be listed in the UI configuration panel for run-time selection

Caution

Make sure that the referenced CSS Class is provided with your application

The following steps are required:

Developer Guide

Providing CSS Class Names to an Adaptable Style

FAQ

Can I provide transparency to the colour? Yes, this was added in Version 13.1. You can now provide a colour as rgba:

BackColor: "rgba(255, 255, 224, 0.3)"