/ Mytril

Building layouts with grid components with Mytril

The Mytril grid system uses a flexible 12-column layout powered by flexbox, allowing developers to create responsive and customized designs with ease. With adaptable breakpoints and a range of components, Mytril’s grid enables tailored, device-friendly layouts.

Core grid sub components

Component Description
Container The main element to house grid layouts.
Row Used to define horizontal rows of columns.
Col Specifies individual columns within a row.
Spacer Adds adjustable spacing between columns.
<script>
	import { Container, Row, Col } from 'mytril';
</script>

<Container>
	<Row>
		<Col>1</Col>
		<Col>2</Col>
		<Col>3</Col>
		<!-- Add more columns as needed -->
	</Row>
</Container>

Responsive breakpoints grid system

Mytril’s grid system includes seven default breakpoints (xs, sm, md, lg, xl, xxl, and default ) designed to match specific screen sizes. Each breakpoint allows you to target particular devices or orientations, ensuring flexibility across viewports.

These breakpoints are defined within Mytril’s configuration and can be customized to fit specific project needs. To modify breakpoints, you can adjust the settings in plugins/mytril.(js|ts), tailoring your grid to accommodate different design preferences and responsive requirements.

Customizing grid layouts

With the Col component, you can define custom spans and adjust layouts for different breakpoints. The following example adapts column widths based on screen size:

<script>
	import { Container, Row, Col } from 'mytril';
</script>

<Container>
	<Row dense>
		<Col cols="12" lg="4">1</Col>
		<Col cols="12" md="6" lg="2">2</Col>
		<Col cols="12" md="6" lg="2">3</Col>
		<Col cols="12" lg="4">4</Col>
	</Row>
</Container>

Properties of each grid component

Each component in the grid system has properties that allow for precise layout control:

Container

<script>
	import { Container } from 'mytril';
</script>

<Container>// your content</Container>
Property Type Default Description
tag string div Specify a custom tag used on the root element.
fluid boolean false Removes maximum-width size breakpoints.
fillHeight boolean false The class fill-height applies height: 100% to an element.

Row

<script>
	import { Container, Row } from 'mytril';
</script>

<Container>
	<Row>// your content</Row>
</Container>
Property Type Default Description
tag string div Specify a custom tag used on the root element.
dense boolean false Reduces the gutter between Col.
noGutters boolean false Removes the gutter between Col.
align string undefined Applies the align-items css property.
alignXs string undefined Changes the align-items property on extra small and greater breakpoints.
alignSm string undefined Changes the align-items property on small large and greater breakpoints.
alignMd string undefined Changes the align-items property on medium and greater breakpoints.
alignLg string undefined Changes the align-items property on large and greater breakpoints.
alignXl string undefined Changes the align-items property on extra large and greater breakpoints.
alignXxl string undefined Changes the align-items property on extra extra large and greater breakpoints.
alignContent string undefined Applies the align-content css property.
alignContentXs string undefined Changes the align-content property on extra small and greater breakpoints.
alignContentSm string undefined Changes the align-content property on small and greater breakpoints.
alignContentMd string undefined Changes the align-content property on medium and greater breakpoints.
alignContentLg string undefined Changes the align-content property on large and greater breakpoints.
alignContentXl string undefined Changes the align-content property on extra large and greater breakpoints.
alignContentXxl string undefined Changes the align-content property on extra extra large and greater breakpoints.
justify string undefined Applies the justify-content css property.
justifyXs string undefined Changes the justify-content property on extra small and greater breakpoints.
justifySm string undefined Changes the justify-content property on small and greater breakpoints.
justifyMd string undefined Changes the justify-content property on medium and greater breakpoints.
justifyLg string undefined Changes the justify-content property on
large and greater breakpoints.
justifyXl string undefined Changes the justify-content property on extra large and greater breakpoints.
justifyXxl string undefined Changes the justify-content property on extra extra large and greater breakpoints.

Col

<script>
	import { Container, Row, Col } from 'mytril';
</script>

<Container>
	<Row>
		<Col>// your content</Col>
	</Row>
</Container>
Property Type Default Description
tag string div Specify a custom tag used on the root element.
alignSelf string undefined Applies the align-self
css property.
cols string number undefined Sets the default number of columns the component extends. Available options are: 1 -> 12 and auto.
xs string number undefined Changes the number of columns on extra small and greater breakpoints.
sm string number undefined Changes the number of columns on small and greater breakpoints.
md string number undefined Changes the number of columns on medium and greater breakpoints.
lg string number undefined Changes the number of columns on large and greater breakpoints.
xl string number undefined Changes the number of columns on extra large and greater breakpoints.
xxl string number undefined Changes the number of columns on extra extra large and greater breakpoints.
offset string undefined Applies the offset css property.
offsetXs string undefined Changes the offset property on extra small and greater breakpoints.
offsetSm string undefined Changes the offset property on small and greater breakpoints.
offsetMd string undefined Changes the offset property on medium and greater breakpoints.
offsetLg string undefined Changes the offset property on large and greater breakpoints.
offsetXl string undefined Changes the offset property on extra large and greater breakpoints.
offsetXxl string undefined Changes the offset property on extra extra large and greater breakpoints.
order string undefined Sets the default order for the column.
orderXs string undefined Changes the order property on extra small and greater breakpoints.
orderSm string undefined Changes the order property on small and greater breakpoints.
orderMd string undefined Changes the order property on medium and greater breakpoints.
orderLg string undefined Changes the order property on large and greater breakpoints.
orderXl string undefined Changes the order property on extra large and greater breakpoints.
orderXxl string undefined Changes the order property on extra extra large and greater breakpoints.

Spacer

<script>
	import { Container, Row, Col, Spacer } from 'mytril';
</script>

<Container>
	<Row>
		<Col>// your content 1</Col>
		<Spacer />
		<Col>// your content 2</Col>
	</Row>
</Container>
Property Type Default Description
tag string div Specify a custom tag used on the root element.

Key benefits of this grid system

  1. Effortless responsiveness: pre-defined breakpoints make adapting layouts to various screen sizes easy.
  2. Fine-grained control: alignment, spacing, and ordering can be customized without additional CSS.
  3. Developer-focused design: each component integrates smoothly, saving time and simplifying layout management.

Using Mytril’s grid components, developers can build professional-grade, responsive layouts that are efficient and easy to manage.

Minedelve respects your privacy

Minedelve and our partners use cookies or similar technologies to enable us to improve the site, your experience and to ensure the proper functioning of the site, to collect statistics in order to optimize the services offered, and to adapt Minedelve's content.