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

ComponentDescription
GridThe main element to house grid layouts.
GridRowUsed to define horizontal rows of columns.
GridColSpecifies individual columns within a row.
SpacerAdds adjustable spacing between columns.
<script>
	import { Grid, GridRow, GridCol } from 'mytril';
</script>

<Grid>
	<GridRow>
		<GridCol>1</GridCol>
		<GridCol>2</GridCol>
		<GridCol>3</GridCol>
		<!-- Add more columns as needed -->
	</GridRow>
</Grid>

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 GridCol component, you can define custom spans and adjust layouts for different breakpoints. The following example adapts column widths based on screen size:

<script>
	import { Grid, GridRow, GridCol } from 'mytril';
</script>

<Grid>
	<GridRow dense>
		<GridCol cols="12" lg="4">1</GridCol>
		<GridCol cols="12" md="6" lg="2">2</GridCol>
		<GridCol cols="12" md="6" lg="2">3</GridCol>
		<GridCol cols="12" lg="4">4</GridCol>
	</GridRow>
</Grid>

Properties of each grid component

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

Grid

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

<Grid>// your content</Grid>
PropertyTypeDefaultDescription
tagstringdivSpecify a custom tag used on the root element.
fluidbooleanfalseRemoves maximum-width size breakpoints.
fillHeightbooleanfalseThe class fill-height applies height: 100% to an element.

GridRow

<script>
	import { Grid, GridRow } from 'mytril';
</script>

<Grid>
	<GridRow>// your content</GridRow>
</Grid>
PropertyTypeDefaultDescription
tagstringdivSpecify a custom tag used on the root element.
densebooleanfalseReduces the gutter between GridCol.
noGuttersbooleanfalseRemoves the gutter between GridCol.
alignstringundefinedApplies the align-items css property.
alignXsstringundefinedChanges the align-items property on extra small and greater breakpoints.
alignSmstringundefinedChanges the align-items property on small large and greater breakpoints.
alignMdstringundefinedChanges the align-items property on medium and greater breakpoints.
alignLgstringundefinedChanges the align-items property on large and greater breakpoints.
alignXlstringundefinedChanges the align-items property on extra large and greater breakpoints.
alignXxlstringundefinedChanges the align-items property on extra extra large and greater breakpoints.
alignContentstringundefinedApplies the align-content css property.
alignContentXsstringundefinedChanges the align-content property on extra small and greater breakpoints.
alignContentSmstringundefinedChanges the align-content property on small and greater breakpoints.
alignContentMdstringundefinedChanges the align-content property on medium and greater breakpoints.
alignContentLgstringundefinedChanges the align-content property on large and greater breakpoints.
alignContentXlstringundefinedChanges the align-content property on extra large and greater breakpoints.
alignContentXxlstringundefinedChanges the align-content property on extra extra large and greater breakpoints.
justifystringundefinedApplies the justify-content css property.
justifyXsstringundefinedChanges the justify-content property on extra small and greater breakpoints.
justifySmstringundefinedChanges the justify-content property on small and greater breakpoints.
justifyMdstringundefinedChanges the justify-content property on medium and greater breakpoints.
justifyLgstringundefinedChanges the justify-content property on
large and greater breakpoints.
justifyXlstringundefinedChanges the justify-content property on extra large and greater breakpoints.
justifyXxlstringundefinedChanges the justify-content property on extra extra large and greater breakpoints.

GridCol

<script>
	import { Grid, GridRow, GridCol } from 'mytril';
</script>

<Grid>
	<GridRow>
		<GridCol>// your content</GridCol>
	</GridRow>
</Grid>
PropertyTypeDefaultDescription
tagstringdivSpecify a custom tag used on the root element.
alignSelfstringundefinedApplies the align-self
css property.
colsstring numberundefinedSets the default number of columns the component extends. Available options are: 1 -> 12 and auto.
xsstring numberundefinedChanges the number of columns on extra small and greater breakpoints.
smstring numberundefinedChanges the number of columns on small and greater breakpoints.
mdstring numberundefinedChanges the number of columns on medium and greater breakpoints.
lgstring numberundefinedChanges the number of columns on large and greater breakpoints.
xlstring numberundefinedChanges the number of columns on extra large and greater breakpoints.
xxlstring numberundefinedChanges the number of columns on extra extra large and greater breakpoints.
offsetstringundefinedApplies the offset css property.
offsetXsstringundefinedChanges the offset property on extra small and greater breakpoints.
offsetSmstringundefinedChanges the offset property on small and greater breakpoints.
offsetMdstringundefinedChanges the offset property on medium and greater breakpoints.
offsetLgstringundefinedChanges the offset property on large and greater breakpoints.
offsetXlstringundefinedChanges the offset property on extra large and greater breakpoints.
offsetXxlstringundefinedChanges the offset property on extra extra large and greater breakpoints.
orderstringundefinedSets the default order for the column.
orderXsstringundefinedChanges the order property on extra small and greater breakpoints.
orderSmstringundefinedChanges the order property on small and greater breakpoints.
orderMdstringundefinedChanges the order property on medium and greater breakpoints.
orderLgstringundefinedChanges the order property on large and greater breakpoints.
orderXlstringundefinedChanges the order property on extra large and greater breakpoints.
orderXxlstringundefinedChanges the order property on extra extra large and greater breakpoints.

Spacer

<script>
	import { Grid, GridRow, GridCol, Spacer } from 'mytril';
</script>

<Grid>
	<GridRow>
		<GridCol>// your content 1</GridCol>
		<Spacer />
		<GridCol>// your content 2</GridCol>
	</GridRow>
</Grid>
PropertyTypeDefaultDescription
tagstringdivSpecify 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.

  1. Home
Help us improve this component!
or

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.