The container block serve as the
fundamental building blocks for layouts. Containers are helpful when utilizing our default Grid system.
Containers are designed to contain, provide padding, and, in certain cases, center the content
within them. While it is possible to nest containers, most layouts do not necessitate such nesting.
It's important to note that while containers provide structure and aid in maintaining a consistent
layout, they are not mandatory for every use case. Depending on your specific layout requirements,
you may choose to use containers selectively.
The section below illustrates how each container’s max-width changes across each breakpoint:
Class | Small ( >36em ) | Medium ( >48em ) | Large ( >62em ) | XLarge ( >75em ) |
---|---|---|---|---|
.container | 33.75em | 45em | 60em | 71.25em |
.container--fluid | 100% | 100% | 100% | 100% |
The framework utilizes EM units instead of pixels because EM units offer greater flexibility and scalability compared to pixels. With EM units, the layout and design elements can adapt and scale proportionally, making it easier to achieve responsive and flexible designs across various devices and screen sizes.
<div class="container"></div>
The block .grid defines the grid layout. With the modifier grid--cols-x it can be specified how many columns the layout is divided into
The elements .grid__col are used within the block and define the individual column widths. The modifier grid__col--X indicates how many columns the element occupies in the grid where x is a number between 1 and 12.
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--1 bg-light">1/12<div>
</div>
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--2 bg-light">2/12</div>
</div>
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--3 bg-light">3/12</div>
</div>
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--4 bg-light">4/12</div>
</div>
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--5 bg-light">5/12</div>
</div>
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--6 bg-light">6/12</div>
</div>
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--7 bg-light">7/12</div>
</div>
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--8 bg-light">8/12</div>
</div>
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--9 bg-light">9/12</div>
</div>
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--10 bg-light">10/12</div>
</div>
<div class="grid grid--cols-12 p-1">
<div class="grid__col grid__col--11 bg-light">11/12</div>
</div>
<div class="grid p-1">
<div class="grid__col bg-light">12/12</div>
</div>
By combining the .grid__col-x modifier with the appropriate suffixes (-sm, -md, -lg, -xl), you can define unique grid layouts for small, medium, large, and extra-large viewports.
For example, to make a column Full width on mobile , half width on tablet and one third width on deskop:
<divclass="grid grid--cols-12">
<div class="grid__col grid__col--12 grid__col--6-md grid__col--4-lg bg-light">Full width on mobile, half width tablet, one third width desktop</div>
</div>
The Form includes styles for various form elements such as input fields, labels, select boxes, checkboxes, and radio buttons. The component is designed with a clear and readable structure, making it easy to modify and customize. It also includes support for alignment of form elements and a custom styling for checkboxes and radio buttons. Overall, it's a great addition to any project that requires consistent and reusable form styling.
<form class="form"> <div class="form__item"> <label class="form__radio-label"> <input type="radio" name="radio" value="value"> <span class="form__radio-custom"></span> Radio Button Label </label> </div> <div class="form__item"> <label class="form__label" for="email">Input Label</label> <input class="form__input" type="email" id="email" name="email" required> </div> <div class="form__item"> <button class="button" type="submit">Submit</button> </div> </form>
To create an aligned form, add the .form--aligned modifier. In an aligned form, the labels are right-aligned against the form input controls.
<form class="form form--aligned"> <div class="form__item"> <label class="form__label" for="input1">Input Label</label> <input class="form__input" type="text" id="input1"> </div> <div class="form__item"> <label class="form__checkbox-label"> <input type="checkbox" name="checkbox" value="value"> <span class="form__checkbox-custom"></span> Checkbox Label </label> </div> <div class="form__item"> <button class="button" type="submit">Submit</button> </div> </form>
To create multi-column forms, include your form elements within a Grid. Creating responsive multi-column forms (like the example below) requires Kiba Responsive Grids to be present on the page.
<form class="form"> <div class="grid grid--cols-9"> <div class="grid__col grid__col--12 grid__col--3 p-2"> <div class="form__item"> <label class="form__label" for="name">Input Label</label> <input class="form__input" type="text" id="name" name="name" required> </div> </div> <div class="grid_col grid__col--12 grid__col--3 p-2"> <div class="form__item"> <label class="form__label" for="name">Select Label</label> <select class="form__select" id="dropdown-menu"> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <option value="option3">Option 3</option> </select> </div> </div> <div class="grid__col grid__col--12 grid__col--3 p-2"> <div class="form__item"> <label class="form__label" for="name2">Input Label</label> <input class="form__input" type="text" id="name2" name="name2" required> </div> </div> </div> <div class="grid grid--cols-12"> <div class="grid__col grid__col--12 p-2"> <div class="form__item"> <div class="form__item"> <label class="form__checkbox-label"> <input type="checkbox" name="checkbox" value="value"> <span class="form__checkbox-custom"></span> Checkbox Label </label> </div> </div> </div> </div> </form>
To add buttons, you can use the .button block
The .button--disabled modifier can be used to disable the button. In
this
state, the button has reduced opacity, and the cursor changes to indicate that it cannot be clicked.
The .button--link modifier changes the button's appearance to
resemble a
text link.
<button class="button">Button</button> <button class="button button--link">Button Link</button> <button class="button button--disabled" disabled>Disabled Button</button>
a standard table is initiated with the block .table
Header | Header | Header |
---|---|---|
1 | 2 | 3 |
1 | 2 | 3 |
1 | 2 | 3 |
<table class="table"> <thead class="table__head"> <tr class="table__row"> <th class="table__header">Header</th> <th class="table__header">Header</th> <th class="table__header">Header</th> </tr> </thead> <tbody class="table__body"> <tr class="table__row"> <td class="table__cell">1</td> <td class="table__cell">2</td> <td class="table__cell">3</td> </tr> <tr class="table__row"> <td class="table__cell">1</td> <td class="table__cell">2</td> <td class="table__cell">3</td> </tr> <tr class="table__row"> <td class="table__cell">1</td> <td class="table__cell">2</td> <td class="table__cell">3</td> </tr> </tbody> </table>
There are two different modifiers for the table. With .table--fluid the table gets a width of 100% and with the modifier .table--striped every second line is inserted.
Header | Header | Header |
---|---|---|
1 | 2 | 3 |
1 | 2 | 3 |
1 | 2 | 3 |
<table class="table table--striped table--fluid"> <thead class="table__head"> <tr class="table__row"> <th class="table__header">Header</th> <th class="table__header">Header</th> <th class="table__header">Header</th> </tr> </thead> <tbody class="table__body"> <tr class="table__row"> <td class="table__cell">1</td> <td class="table__cell">2</td> <td class="table__cell">3</td> </tr> <tr class="table__row"> <td class="table__cell">1</td> <td class="table__cell">2</td> <td class="table__cell">3</td> </tr> <tr class="table__row"> <td class="table__cell">1</td> <td class="table__cell">2</td> <td class="table__cell">3</td> </tr> </tbody> </table>
Utility classes are a set of highly reusable CSS classes that provide specific styling for common design patterns or functional requirements. They offer a quick and efficient way to apply small, single-purpose styles to HTML elements without the need for writing custom CSS for each individual case. By combining utility classes with the BEM methodology, we can achieve a powerful and flexible system for structuring our CSS code.