Need a special offer?Find out if your project fits.
+
  1. API reference
  • Introduction
  • Connecting to Data Source
  • Browser compatibility
  • Documentation for older versions
  • Table of contents

    Changing themes

    You can customize the appearance of Flexmonster using CSS — the same way as for regular HTML. Flexmonster offers predefined skins and provides their source code so you can quickly create custom ones.

    Built-in themes

    Flexmonster comes with a variety of predefined CSS themes:

    Explore all available themes inside the flexmonster/theme/ folder or check out the Flexmonster themes demo. If no theme is specified, the component uses the default theme. Its CSS is available inside the flexmonster/flexmonster.css and flexmonster/flexmonster.min.css files. To apply a different theme, add the reference to the minified CSS file of the chosen theme. For example, to apply the lightblue theme, insert the following line of code:

    <link rel="stylesheet" type="text/css" href="/theme/lightblue/flexmonster.min.css" />

    To insert some other theme, just replace lightblue from the CSS reference with the name of the chosen theme. The 2.3-styled theme can be set like this:

    <link rel="stylesheet" type="text/css" href="/theme/old/flexmonster.min.css" />

    Check out the Flexmonster default theme in the pivot table demo.

    Adding a custom theme

    You can create your custom theme using the custom theme builder or manually.

    Create using the theme builder

    This guide will help you create a custom theme for Flexmonster using the theme builder.

    Step 1. Download the .zip archive with the theme builder or clone it from GitHub with the following commands:

    git clone https://github.com/flexmonster/custom-theme-builder
    cd custom-theme-builder

    Step 2. Install the npm dependencies described in package.json:

    npm install

    Step 3. In the custom-theme-builder/ folder, find and open the flexmonster.less file. It contains styles for Flexmonster. Feel free to adjust variable values and colors to your needs.

    For example, let's change font styles and the theme main color:

    @font-family: serif;
    @font-size: 15px;
    ...
    @theme-color: antiquewhite;

    Other CSS styles can be customized similarly. 

    Step 4. Run the custom theme builder to generate CSS and minified CSS files for the theme:

    npm start

    As a result, the generated-theme/ folder with your custom theme files (flexmonster.css, flexmonster.min.css) will appear in custom-theme-builder/.

    Step 5. Apply your theme to the component by including the CSS or minified CSS file:

    <link rel="stylesheet" type="text/css"
    href="your-path\custom-theme-builder\generated-theme\flexmonster.min.css"
    />

    Now launch the page from a browser — your custom theme is set for the component.

    Create manually

    Creating a custom theme manually involves the following steps:

    Step 1. Inside the theme/ folder, make a copy of any folder with an existing theme (e.g., lightblue/).

    Step 2. Rename the copied folder to a custom theme name.

    Step 3. Replace the theme’s colors with your custom ones. There are several ways to achieve this:

    • The recommended way requires using a CSS pre-processor named Less. Set custom colors inside the flexmonster.less file from the custom theme’s folder.
      After replacing the necessary colors, compile flexmonster.less into flexmonster.css and flexmonster.min.css.
      More details about this compilation are available in the Less documentation.
    • The other option is to edit the colors inside the flexmonster.css file from your theme folder. This approach is not recommended because it complicates updating your own theme with the updates made in the component CSS.

    Step 4. Add the reference to the CSS or to the minified CSS. This will apply your new theme:

    <link rel="stylesheet" type="text/css" 
    href="/theme/your-new-theme/flexmonster.css"
    />

    Further customization

    To add custom CSS above basic styling, we suggest one of the following approaches:

    • If you use Less, we advise creating your own theme based on one of the existing ones. Create your own theme with the help of the adding your own theme guide. Then you can open your theme/your-new-theme/flexmonster.less file and write custom code at the bottom of this file, after the definition of the variables. This way our base Less file theme/flexmonster-base.less will remain unchanged and will not cause any issues during updating. Check out the example with custom Less code added on top of the orange theme. Open the theme/orange/flexmonster.less file and find the following lines:
      #fm-pivot-view .fm-grid-layout div.fm-header {
      border-right: 1px solid @theme-color-supersuperlight;
      border-bottom: 1px solid @theme-color-supersuperlight;
      }

      This is custom code that redefines border color for header cells. This color is the same as for all other cells. But for the orange theme, the border color for header cells is set to @theme-color-supersuperlight. You can add other custom code the same way.

    • If you do not use Less, we recommend writing your custom CSS code in a separate file (e.g. my-flexmonster-styles.css) and to keep the original styles in flexmonster.css without changes. Take a look at the following example: how to add custom CSS for the grid. It demonstrates how grid colors can be changed via additional CSS.

    The full list of examples with custom CSS is available on our examples page.

    What’s next?

    You may be interested in the following articles: