<section>
    <h2>Two Column List</h2>
    <ul class="grav-o-two-column grav-o-reset-list">
        <li>

            Lorem

        </li>
        <li>

            ipsum

        </li>
        <li>
            <a href="#">
                dolor
            </a>
        </li>
        <li>

            sit

        </li>
        <li>
            <a href="#">
                amet
            </a>
        </li>
        <li>
            <a href="#">
                consectetur
            </a>
        </li>
        <li>
            <a href="#">
                adipiscing
            </a>
        </li>
        <li>

            elit

        </li>
        <li>

            sed

        </li>
        <li>

            do

        </li>
        <li>

            eiusmod

        </li>
        <li>
            <a href="#">
                tempor
            </a>
        </li>
    </ul>
</section>
<section>
    <h2>Three Column List</h2>
    <ul class="grav-o-three-column grav-o-reset-list">
        <li>

            Lorem

        </li>
        <li>

            ipsum

        </li>
        <li>
            <a href="#">
                dolor
            </a>
        </li>
        <li>

            sit

        </li>
        <li>
            <a href="#">
                amet
            </a>
        </li>
        <li>
            <a href="#">
                consectetur
            </a>
        </li>
        <li>
            <a href="#">
                adipiscing
            </a>
        </li>
        <li>

            elit

        </li>
        <li>

            sed

        </li>
        <li>

            do

        </li>
        <li>

            eiusmod

        </li>
        <li>
            <a href="#">
                tempor
            </a>
        </li>
    </ul>
</section>
<section>
    <h2>Four Column List</h2>
    <ul class="grav-o-four-column grav-o-reset-list">
        <li>

            Lorem

        </li>
        <li>

            ipsum

        </li>
        <li>
            <a href="#">
                dolor
            </a>
        </li>
        <li>

            sit

        </li>
        <li>
            <a href="#">
                amet
            </a>
        </li>
        <li>
            <a href="#">
                consectetur
            </a>
        </li>
        <li>
            <a href="#">
                adipiscing
            </a>
        </li>
        <li>

            elit

        </li>
        <li>

            sed

        </li>
        <li>

            do

        </li>
        <li>

            eiusmod

        </li>
        <li>
            <a href="#">
                tempor
            </a>
        </li>
    </ul>
</section>
{%- macro twoColumnList(list) -%}
  <ul class="grav-o-two-column grav-o-reset-list">
    {% for item in list -%}
      <li>
        {% if item.url %}<a href="{{ item.url }}">{% endif %}
          {{ item.title }}
          {% if item.url %}</a>{% endif %}
      </li>
    {%- endfor %}
  </ul>
{%- endmacro -%}

{%- macro threeColumnList(list) -%}
  <ul class="grav-o-three-column grav-o-reset-list">
    {% for item in list -%}
      <li>
        {% if item.url %}<a href="{{ item.url }}">{% endif %}
          {{ item.title }}
          {% if item.url %}</a>{% endif %}
      </li>
    {%- endfor %}
  </ul>
{%- endmacro -%}

{%- macro fourColumnList(list) -%}
    <ul class="grav-o-four-column grav-o-reset-list">
    {% for item in list -%}
      <li>
        {% if item.url %}<a href="{{ item.url }}">{% endif %}
          {{ item.title }}
        {% if item.url %}</a>{% endif %}
      </li>
    {%- endfor %}
  </ul>
{%- endmacro -%}

<section>
  <h2>Two Column List</h2>
  {{- twoColumnList(list) | safe -}}
</section>
<section>
  <h2>Three Column List</h2>
  {{- threeColumnList(list) | safe -}}
</section>
<section>
  <h2>Four Column List</h2>
  {{- fourColumnList(list) | safe -}}
</section>
{
  "text": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam",
  "url": "#",
  "listItems": [
    {
      "htmlContent": "Some list item content"
    },
    {
      "htmlContent": "More list item content"
    },
    {
      "htmlContent": "Even more list item content"
    },
    {
      "htmlContent": "I can't believe there's still more list item content"
    },
    {
      "htmlContent": "Seriously?! That's enough now."
    }
  ],
  "footer": {
    "copy": "&copy; 2019 <strong>Buildit</strong>. All rights reserved.",
    "linksA": [
      {
        "label": "Stories",
        "url": "#"
      },
      {
        "label": "People",
        "url": "#"
      },
      {
        "label": "Jobs",
        "url": "#"
      }
    ],
    "linksB": [
      {
        "label": "Terms",
        "url": "#"
      },
      {
        "label": "Accessibility",
        "url": "#"
      },
      {
        "label": "Privacy & Cookie Policy",
        "url": "https://wiprodigital.com/privacy-policy"
      }
    ]
  },
  "hero": {
    "pullout": "Big, attention-grabbing headline",
    "paragraph": "Witty subtitle",
    "cta": {
      "text": "Clickbaity label",
      "url": "#"
    }
  },
  "img": {
    "random": {
      "src": "/images/img-random-1.png",
      "alt": "A placeholder image with an arbitrary aspect ratio."
    },
    "square": {
      "src": "/images/img-1x1.png",
      "alt": "A placeholder image with a perfect square (1:1) aspect ratio."
    },
    "tv": {
      "src": "/images/img-4x3.png",
      "alt": "A placeholder image with a 4:3 aspect ratio, like an old TV."
    },
    "widescreen": {
      "src": "/images/img-16x9.png",
      "alt": "A placeholder image with a 16:9 aspect ratio, like a widescreen TV."
    },
    "logo": {
      "src": "/images/img-random-2.png",
      "alt": "A test image for a logo with an arbitrary aspect ratio."
    }
  },
  "title": "Page title",
  "header": {
    "url": "./homepage",
    "links": [
      {
        "text": "Jobs",
        "url": "./jobs"
      },
      {
        "text": "Locations",
        "url": "./locations"
      }
    ],
    "externalLinks": [
      {
        "text": "Fancy external website",
        "url": "./error-page"
      }
    ]
  },
  "sections": [
    {
      "title": "Example section",
      "class": "grav-o-full-bleed__content",
      "content": [
        {
          "paragraph": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam."
        }
      ]
    }
  ],
  "section": {
    "title": "This is the title for a section",
    "class": "grav-o-full-bleed__content",
    "content": [
      {
        "paragraph": "Paragraph lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
      },
      {
        "blockquote": "Blockquote lorem ipsum dolor sit amet, consectetur adipisicing elit"
      },
      {
        "twoColumnsList": [
          {
            "htmlContent": "Vestibulum auctor dapibus neque."
          },
          {
            "htmlContent": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
          },
          {
            "htmlContent": "Aliquam tincidunt mauris eu risus."
          },
          {
            "htmlContent": "Labore et dolore magna aliqua."
          },
          {
            "htmlContent": "Phasellus tempus, orci non mattis sagittis."
          }
        ]
      },
      {
        "inlineRow": [
          {
            "text": "First link",
            "url": "#"
          },
          {
            "text": "Second link",
            "url": "#"
          },
          {
            "text": "Third link",
            "url": "#"
          }
        ]
      },
      {
        "imgCards": [
          {
            "title": "Some fascinating, attention-grabbing headling",
            "content": "Ideally, with a click-baity tagline that entices to you to visit!",
            "image": {
              "src": "/images/img-random-1.png",
              "alt": "Brief description of this fascinating image"
            }
          },
          {
            "title": "Labore et dolore magna aliqua",
            "content": "Vestibulum pharetra arcu enim, nec porttitor quam ullamcorper et. Phasellus tempus, orci non mattis sagittis, lectus erat fringilla odio, nec auctor erat augue quis eros.",
            "image": {
              "src": "/images/img-random-1.png",
              "alt": "Phasellus tempus, orci non mattis"
            }
          },
          {
            "title": "Nanotechnology immersion along the information highway",
            "content": "Leverage agile frameworks to provide a robust synopsis for high level overviews.",
            "image": {
              "src": "/images/img-random-1.png",
              "alt": "Bring to the table win-win survival strategies"
            }
          }
        ]
      },
      {
        "imgLinks": [
          {
            "url": "#",
            "image": {
              "src": "/images/img-random-1.png",
              "alt": "Image linke #1"
            }
          },
          {
            "url": "#",
            "image": {
              "src": "/images/img-random-2.png",
              "alt": "Image linke #2"
            }
          },
          {
            "url": "#",
            "image": {
              "src": "/images/img-random-3.png",
              "alt": "Image linke #3"
            }
          }
        ]
      }
    ]
  },
  "list": [
    {
      "title": "Lorem"
    },
    {
      "title": "ipsum"
    },
    {
      "title": "dolor",
      "url": "#"
    },
    {
      "title": "sit"
    },
    {
      "title": "amet",
      "url": "#"
    },
    {
      "title": "consectetur",
      "url": "#"
    },
    {
      "title": "adipiscing",
      "url": "#"
    },
    {
      "title": "elit"
    },
    {
      "title": "sed"
    },
    {
      "title": "do"
    },
    {
      "title": "eiusmod"
    },
    {
      "title": "tempor",
      "url": "#"
    }
  ]
}
  • Handle: @n-column-list
  • Preview:
  • Filesystem Path: src/components/01-atoms/02-lists/04-n-column-list/n-column-list.njk
  • Referenced by (1): @jobs

Purpose

Using a column layout class (optionally with an extra list specific class) gives lists (ul or ol) a column layout.

Gravity provides three versions of the column layout class out of the box: .grav-o-two-column, .grav-o-three-column and .grav-o-four-column. These determine the number of columns the layout has at the largest viewport. Columns will break down to lower counts on smaller viewports.

Lists also require the .grav-o-reset-list class if you want to remove the default list bullet style and padding.