EMBL Grid embl-layout

The EMBL Layout System is applied to the Container components. It is an asymmetrical grid of four columns. There are 3 layout options.

github location npm version

Usage

All EMBL Layouts are single column until the viewport reaches "tablet" size. EMBL Layouts have two classes. One to define the grid area and where it is in the Page Grid another to determine what columns there are available.

The CSS classnames available should be used on their own on a Container or added to a Containers existing classname declaration in the HTML.

A EMBL Layout should only be applied to Containers. For Blocks you should use vf-grid.

If the EMBL Layout System is being added to a Container that has a classname we separate the classes in the HTML with a |.

Variants

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Necessitatibus fugiat delectus dolore molestias rerum? Dolores doloribus impedit quasi provident odit perferendis vitae incidunt, mollitia repellendus a alias necessitatibus, molestiae! Nesciunt. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dicta dolor odit vel ipsa consequatur sunt, esse sapiente commodi harum velit asperiores quasi nostrum sint dolorem blanditiis eum magnam voluptatibus aliquam.

Nunjucks syntax

Depending on your environment you'll want to use render or include. As a rule of thumb: server-side use include, precompiled browser use render. If you're using vf-eleventy you should use include.

Using include

You'll need to pass a context object from your code or Yaml file (example), as well as the path to the Nunjucks template. Nunjucks' include is an abstraction of render and provides some additional portability.


{% set context fromYourYamlFile %}
- or -
{% set context = { 
"component-type" : "embl-layout",
"embl_grid__type" : "centered",
 }
%}
{% include "../path_to/embl-grid/embl-grid.njk" %}
                

Using render

This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include is not be available.


{% render '@embl-grid', {
  "component-type" : "embl-layout",
  "embl_grid__type" : "centered",}
%}
                
HTML
<div class="embl-grid embl-grid--has-centered-content">
  <div></div>
  <div>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Necessitatibus fugiat delectus dolore molestias rerum? Dolores doloribus impedit quasi provident odit perferendis vitae incidunt, mollitia repellendus a alias necessitatibus, molestiae! Nesciunt. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dicta dolor odit vel ipsa consequatur sunt, esse sapiente commodi harum velit asperiores quasi nostrum sint dolorem blanditiis eum magnam voluptatibus aliquam.</p>
  </div>
  <div></div>
</div>
              

Projects

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Necessitatibus fugiat delectus dolore molestias rerum? Dolores doloribus impedit quasi provident odit perferendis vitae incidunt, mollitia repellendus a alias necessitatibus, molestiae! Nesciunt.

Did you know?

This is some more content that would be in the box.

Nunjucks syntax

Depending on your environment you'll want to use render or include. As a rule of thumb: server-side use include, precompiled browser use render. If you're using vf-eleventy you should use include.

Using include

You'll need to pass a context object from your code or Yaml file (example), as well as the path to the Nunjucks template. Nunjucks' include is an abstraction of render and provides some additional portability.


{% set context fromYourYamlFile %}
- or -
{% set context = { 
"component-type" : "embl-layout",
"embl_grid__type" : "sidebar",
 }
%}
{% include "../path_to/embl-grid/embl-grid.njk" %}
                

Using render

This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include is not be available.


{% render '@embl-grid', {
  "component-type" : "embl-layout",
  "embl_grid__type" : "sidebar",}
%}
                
HTML
<div class="embl-grid embl-grid--has-sidebar">
  <div class="vf-section-header">
    <h2 class="vf-section-header__heading"> Projects</h2>
  </div>
  <div class="vf-content">
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Necessitatibus fugiat delectus dolore molestias rerum? Dolores doloribus impedit quasi provident odit perferendis vitae incidunt, mollitia repellendus a alias necessitatibus, molestiae! Nesciunt.</p>
  </div>

  <div class="vf-box vf-box-theme--primary vf-box--normal">

    <h3 class="vf-box__heading">Did you know?</h3>
    <p class="vf-box__text">This is some more content that would be in the box.</p>
  </div>
</div>
              

Projects

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Necessitatibus fugiat delectus dolore molestias rerum? Dolores doloribus impedit quasi provident odit perferendis vitae incidunt, mollitia repellendus a alias necessitatibus, molestiae! Nesciunt.

Did you know?

This is some more content that would be in the box.

Nunjucks syntax

Depending on your environment you'll want to use render or include. As a rule of thumb: server-side use include, precompiled browser use render. If you're using vf-eleventy you should use include.

Using include

You'll need to pass a context object from your code or Yaml file (example), as well as the path to the Nunjucks template. Nunjucks' include is an abstraction of render and provides some additional portability.


{% set context fromYourYamlFile %}
- or -
{% set context = { 
"component-type" : "embl-layout",
"embl_grid__type" : "sidebar",
"embl_grid__hairline" : true,
 }
%}
{% include "../path_to/embl-grid/embl-grid.njk" %}
                

Using render

This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include is not be available.


{% render '@embl-grid', {
  "component-type" : "embl-layout",
  "embl_grid__type" : "sidebar",
  "embl_grid__hairline" : true,}
%}
                
HTML
<div class="embl-grid embl-grid--has-sidebar embl-grid-has-sidebar--hairline">
  <div class="vf-section-header">
    <h2 class="vf-section-header__heading"> Projects</h2>
  </div>
  <div class="vf-content">
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Necessitatibus fugiat delectus dolore molestias rerum? Dolores doloribus impedit quasi provident odit perferendis vitae incidunt, mollitia repellendus a alias necessitatibus, molestiae! Nesciunt.</p>
  </div>

  <div class="vf-box vf-box-theme--primary vf-box--normal">

    <h3 class="vf-box__heading">Did you know?</h3>
    <p class="vf-box__text">This is some more content that would be in the box.</p>
  </div>
</div>
              

Examples

Installation info

This component is distributed with npm. After installing npm, you can install the embl-grid with this command.

$ yarn add --dev @visual-framework/embl-grid

Sass/CSS

The source files included are written in Sass(scss). You can point your Sass include-path at your node_modules directory and import it like this.

@import "@visual-framework/embl-grid/index.scss";

Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter

Changelog

Changelog

2.2.0

  • Drops custom margin-bottom, you should rely on vf-stack.
  • https://github.com/visual-framework/vf-core/pull/1698

2.1.2

  • Fixes CSS to match stylelint rules.
  • https://github.com/visual-framework/vf-core/pull/1405

2.1.1

  • changes any set- style functions to cleaner version

2.1.0

  • makes the layout something that can now use 'extends' within nunjucks

2.0.4

  • fixes issue with auto and 1fr doing the opposite with the sidebar

2.0.3

  • changes breakpoint for sidebar to be a sidebar from 1024px
  • makes the sidebar smaller until it hits 1300px

2.0.1

  • fixes issue where embl-grid didn't allow for more 'main content' items
  • fixes issue where embl-grid--has-sidebar had it's auto and 1fr backwards

2.0.0

  • removes unused --alt version (use a utility class for background colour)
  • adds more space for content in initial (prime) column and sidebar column (if used)
  • tidies up CSS by using css custom properties for variants
  • removes weird margin that was used beforehand
  • takes the hairline out of --has-sidebar and gives it it's own modifier class

1.0.4

  • The one where we make our CSS grid-gaps gaps
  • https://github.com/visual-framework/vf-core/pull/843

1.0.2

  • .embl-grid uses [main-start] and [main-end] for more reliable positioning of child grids

1.0.1

  • Uses --page-grid-gap custom property for sidebar gap; https://github.com/visual-framework/vf-core/pull/694

1.0.0 (2019-12-17)

  • Initial stable release

Assets



File system location: components/embl-grid

Find an issue on this page? Propose a change or discuss it.