Skip to main content

Grid new

Grid component provides structure for other components using Flexbox based layout system. Grid allows nesting and defining the direction of the content.

While the Grid Item component makes it possible set additional parameters for Grid’s cells, this component can be used without <duet-grid-item/> as well. In that case the direct child elements of Grid will be considered as Grid cells.

Examples

Open in new window
<duet-grid responsive class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive distribution="center" class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive distribution="right" class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive distribution="space-between" class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive distribution="space-around" class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive distribution="space-evenly" class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive alignment="top" class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive alignment="center" class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive alignment="bottom" class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive alignment="stretch" class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive alignment="baseline" class="grid-demo">
<duet-grid-item><div style="line-height:1.2">Grid Item<br/>with multiple<br/>rows of text.</div></duet-grid-item>
<duet-grid-item><div style="line-height:7">Grid Item</div></duet-grid-item>
<duet-grid-item><div style="line-height:3">Grid Item</div></duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive alignment="stretch" class="grid-demo">
<duet-grid-item fill>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive alignment="stretch" class="grid-demo">
<duet-grid-item fill>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item min-width="300px">Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive alignment="stretch" class="grid-demo">
<duet-grid-item fill>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item fill>Grid Item</duet-grid-item>
<duet-grid-item fill>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive direction="vertical" class="grid-demo">
<duet-grid-item>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-grid responsive alignment="stretch" class="grid-demo">
<duet-grid-item fill>
<duet-grid responsive alignment="stretch">
<duet-grid-item fill>Grid Item<br/>with multiple<br/>rows of text.</duet-grid-item>
<duet-grid-item fill>Grid Item</duet-grid-item>
<duet-grid-item fill>Grid Item</duet-grid-item>
</duet-grid>
</duet-grid-item>
<duet-grid-item>Grid Item</duet-grid-item>
</duet-grid>
Open in new window
<duet-layout center margin="none">
<div slot="main">
<duet-card padding="large" margin="none">
<div>
<duet-choice-group
value="one"
label="Asiointikieli"
direction="horizontal"
name="group"
responsive>

<duet-choice label="Suomi" type="radio" value="one" expand></duet-choice>
<duet-choice label="Svenska" type="radio" value="two" expand></duet-choice>
<duet-choice label="English" type="radio" value="three" expand></duet-choice>
</duet-choice-group>
</div>
<duet-grid responsive>
<duet-input label="Etunimi" placeholder="Matti" expand></duet-input>
<duet-input label="Sukunimi" placeholder="Meikäläinen" expand></duet-input>
</duet-grid>
<duet-input label="Katuosoite" placeholder="Kotikatu 123" expand></duet-input>
<duet-grid responsive>
<duet-input label="Postinumero" placeholder="00100"></duet-input>
<duet-input label="Kaupunki" placeholder="Helsinki" expand></duet-input>
</duet-grid>
<duet-grid responsive>
<duet-input label="Postinumero" placeholder="00100" expand></duet-input>
<duet-input label="Kaupunki" placeholder="Helsinki"></duet-input>
</duet-grid>
<duet-grid responsive>
<duet-input label="Postinumero" placeholder="00100" expand></duet-input>
<duet-grid-item min-width="calc(33.333% + 8px)"></duet-grid-item>
</duet-grid>
</duet-card>
</div>
</duet-layout>

Properties #

Property Attribute Description Type Default
alignment alignment Adjusts the vertical alignment of the grid items. Can be one of: "top", "bottom", "center", "stretch", "baseline". string "flex-end"
breakpoint breakpoint Switch the breakpoint used to trigger the content stacking. Can be one of "small", "medium". These match to similar media query tokens: $media-query-small and $media-query-medium. string "small"
direction direction Direction of the grid items. Can be one of: "horizontal", "vertical". string "horizontal"
distribution distribution Adjusts the horizontal distribution of the grid items. Can be one of: "default", "left", "right, "center", "space-between", "space-around", "space-evenly". string "default"
mobile mobile Adjusts the horizontal alignment of the grid items on mobile (575px and under). Can be one of: "auto", "left", "right, "center". string ""
responsive responsive Enable or disable the automatic responsive behaviour of the grid component. Setting this option to "true" makes sure that contents are stacked vertically on mobile (575px and under). boolean false

Integration

For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.



Tutorials

Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:

Tutorials

Building Layouts

Tutorials

Server Side Rendering


Troubleshooting

If you experience any issues while using a component, please head over to the Support page for more guidelines and help.