Getting Started formir - pure css framework

Formir is a framework that not require any JS code to fully work

All of logic are based on CSS and <input/> tag elements, thats are required.

<input/> tag has a three very important attribute for Formir, there is: name, id, and for
<input/> is part of form on your website, but we can hide this elements and control all other elements that are directly + or indirectly ~ behind them.

To start working with Formir, you mast know that all elements <input/> ascending one group must have the same name, for example all <input/> in component 'tabs' have to set the same name attribute.
Parts of Formir components have to also set id attribute for each <input/> and have his own <label/> with associated for attribute (the same as id)

Get Formir

Use npm install: npm install formir

Setup Formir

Formir is written on LESS. Files are split by core elements, template elements that are an extension to the core, and application files that will be not part of a component of formir but it will be your own styles.

Start with install or copy framework files to own direction. All files are included in file: less/formir.less you could also use the example of application in file application.less - this is a compilation for this page. All start with this file - you could remove or change the direction, copy from vendor to your direction and modify.

All classes used on this framework is customizable to prevent name collision - less/setup/classes.less

All core variables - the most important for all components are store in - less/setup/core.less for example number of columns for the grid, or unit for each dimension variables, RWD breaking points.

All other variables for each components are store in - less/setup/variables.less.

Mixins are store in direction - less/core/mixins/ there is a lot of prefix function.

In the core there is a logic of CSS, we don't recommend changing these files, use variables or templates file mixins (each component's template has owned class mixin to do the job) - but feel free if such a need arises. Remember to copy all files that will be changed from node_modules and change the include direction..

One file to import all componentsless/formir.less #

import setup #

In this section, we import all setup files, classes, core and variables for the core part of the framework and your themes.

      
        // SETUP
@import "formir/setup/classes";
@import "formir/setup/core";
@import "formir/setup/variables";

  //// THEME SETUP
  @import "formir/themes/default/setup/classes";
  @import "formir/themes/default/setup/core";
  @import "formir/themes/default/setup/variables";


      
    

import core #

In this section we import all components of framework that have core style with logic. If you want you can comment/remove each component that you will not used.

      
        // CORE
  //// MIXINS
  @import "formir/core/mixins/display";
  @import "formir/core/mixins/flex";
  @import "formir/core/mixins/functions";


  //// COMPONENTS
  @import "formir/core/components/form";
  @import "formir/core/components/select";
  @import "formir/core/components/modal";
  @import "formir/core/components/tab";
  @import "formir/core/components/accordion";
  @import "formir/core/components/tooltip";
  @import "formir/core/components/popup";
  @import "formir/core/components/button";
  @import "formir/core/components/chart";
  @import "formir/core/components/description-list";
  @import "formir/core/components/menu";
  @import "formir/core/components/icons";
  @import "formir/core/components/image";
  @import "formir/core/components/table";
  @import "formir/core/components/section";
  @import "formir/core/components/alert";

  //// HELPER
  @import "formir/core/helpers/align";
  @import "formir/core/helpers/display";
  @import "formir/core/helpers/items";
  @import "formir/core/helpers/toggle";

  //// Typography
  @import "formir/core/typography/fonts";
  @import "formir/core/typography/heading";
  @import "formir/core/typography/list";
  @import "formir/core/typography/article";
  @import "formir/core/typography/color";
  @import "formir/core/typography/link";

  //// LAYOUTS
  @import "formir/core/layouts/clear";
  @import "formir/core/layouts/grid";
  @import "formir/core/layouts/content";
  @import "formir/core/layouts/dimensions"; // width, height, margin, padding etc.
  @import "formir/core/layouts/side";
  @import "formir/core/layouts/header";
  @import "formir/core/layouts/window";
      
    

import themes #

In the section, you can import your own changes in style using mixins or other selectors that are part of these files. Try to use the same name of the path.

      
        // THEMES
  //// DEFAULT
    ////// LAYOUTS
    @import "formir/themes/default/layouts/side";

    ////// COMPONETS
    @import "formir/themes/default/components/modal";
    @import "formir/themes/default/components/tab";
    @import "formir/themes/default/components/tooltip";
    @import "formir/themes/default/components/chart";
    @import "formir/themes/default/components/accordion";
    @import "formir/themes/default/components/popup";
    @import "formir/themes/default/components/menu";
    @import "formir/themes/default/components/select";
    @import "formir/themes/default/components/button";
    @import "formir/themes/default/components/form";
    @import "formir/themes/default/components/table";
    @import "formir/themes/default/components/alert";

    ////// TYPOGRAPHY
    @import "formir/themes/default/typography/heading";
    @import "formir/themes/default/typography/article";
      
    

Remember, you can copy each file from node_modules direction to your own files scope in project. Copy /less/formir.less and other files that you need to change in your project and change path form node_modules to your root path

example of formir.less file #

      
        // SETUP
@import "/node_modules/formir/less/formir/setup/classes";
@import "/node_modules/formir/less/formir/setup/core";
@import "/node_modules/formir/less/formir/setup/variables";


  //// THEME SETUP
  @import "/node_modules/formir/less/formir/themes/default/setup/classes";
  @import "/node_modules/formir/less/formir/themes/default/setup/core";

  //// COST TRACKER SETUP

  @import "formir/themes/my_project_name/setup/classes";
  @import "formir/themes/my_project_name/setup/core";
  @import "formir/themes/my_project_name/setup/variables";


// CORE
  //// MIXINS
  @import "/node_modules/formir/less/formir/core/mixins/display";
  @import "/node_modules/formir/less/formir/core/mixins/flex";
  @import "/node_modules/formir/less/formir/core/mixins/functions";


  //// COMPONENTS
  @import "/node_modules/formir/less/formir/core/components/form";
  @import "formir/core/components/select";
  @import "/node_modules/formir/less/formir/core/components/modal";
  @import "formir/core/components/tab";
  // @import "/node_modules/formir/less/formir/core/components/accordion";

  ...

  // THEMES
  //// DEFAULT
    ////// LAYOUTS
    @import "formir/themes/my_project_name/layouts/side";

    ////// COMPONETS
    @import "formir/themes/my_project_name/components/modal";
    @import "formir/themes/my_project_name/components/window";
    @import "formir/themes/my_project_name/components/tab";
    @import "/node_modules/formir/less/formir/themes/default/components/tooltip";
    // @import "/node_modules/formir/less/formir/themes/default/components/chart";
    // @import "/node_modules/formir/less/formir/themes/default/components/accordion";

    ...
      
    

Setup your first variables #

core less/formir/setup/core.less #

			
        // Path and dirs
@root-dir: "";  // used for fonts file etc. leave 'formir' as default
@font-dir: "fonts";
@image-dir: "img";

//// Icons path
@font-icon-url-eot: url("@{font-dir}/icons.eot");
@font-icon-url-embedded: url("@{font-dir}/icons.eot");
@font-icon-url-woff2: url("@{font-dir}/icons.woff2");
@font-icon-url-woff: url("@{font-dir}/icons.woff");
@font-icon-url-ttf: url("@{font-dir}/icons.ttf");
@font-icon-url-svg: url("@{font-dir}/icons.svg");

// Base Unit
@base-unit: rem;
@base-steps: 16;
@base-geometric-step: 3;
@colors: body, primary, alternative, link, mute, cancel, success, info, warning, danger, color-1, color-2, color-3;

// Sizes
@sizes: xs, s, m, l, xl, xxl; // can be set for ex. xs, s, m, l etc.. change name of variables for buttons input etc.
@size-xs: 0.6;
@size-s: 0.85;
@size-m: 1.15;
@size-l: 1.5;
@size-xl: 1.75;
@size-xxl: 2;
@input-sizes: s, m, l;

// Layout Unit
@layout-unit: px;
@layout-steps: 8;
@layout-factor: 0.3;
@layout-geometric-step: @base-geometric-step;
@layout-width: @content-max-width;
@layout-height: @content-max-height;

// Rensponsive Web Design

// Break points
@desktop-min-width: 1280px;
@tablet-max-width: 1024px;
@tablet-portrait-max-width: 768px;
@mobile-max-width: 568px;
@mobile-portrait-max-width: 320px;

// Break point on mobile menu
@mobile-menu-max-width: @tablet-portrait-max-width;


// Side break points
@device-width-side-collapse: @tablet-portrait-max-width; // in that device width sidebar will be automatic collapsed, set 0 to off
@device-width-side-hide: @mobile-max-width; // in that device width sidebar (side-hide) will automatic hide, set 0 to off
@device-width-side-show-full: @device-width-side-hide;

@table-mobile-max-width: @tablet-portrait-max-width;

// Z-index
  //// Modals
  @modal-zindex: 10000;

  //// Side
  @side-zindex: 10000;
  //// Tooltips
  @tooltip-zindex: 10000;
  @tooltip-arrow-zindex: 1;
  //// Popups
  @popup-zindex: 10000;
  @popup-arrow-zindex: 1;
  //// Select
  @select-zindex: 10000;

  // Header
  @header-zindex: 10000;


// Content
@content-max-width: unit(1128, @layout-unit);
@content-min-margin: unit(20, @layout-unit);
@content-max-height: unit(600, @layout-unit);