Skip to main content

Layout
Ready

Layout component, while not visible in the user interface itself, provides a structure for other components using a one or two column layout system.

Examples

Open in new window
<duet-layout margin="none">
<div slot="main">
<duet-card heading="Main">Main content</duet-card>
<duet-card heading="More main content">Main content</duet-card>
</div>
</duet-layout>
Open in new window
<duet-layout>
<div slot="top">
<duet-alert icon="messaging-alert">
A simple alert with an icon on left!
</duet-alert>
</div>
<div slot="main">
<duet-card heading="Main">Main content</duet-card>
<duet-card heading="More main content">Main content</duet-card>
</div>
</duet-layout>
Open in new window
<duet-layout margin="none">
<div slot="main">
<duet-card heading="Main">Main content</duet-card>
</div>
<div slot="sidebar">
<duet-card heading="Sidebar">Sidebar content</duet-card>
</div>
</duet-layout>
Open in new window
<duet-layout>
<div slot="top">
<duet-alert icon="messaging-alert">
A simple alert with an icon on left!
</duet-alert>
</div>
<div slot="main">
<duet-card heading="Main">Main content</duet-card>
</div>
<div slot="sidebar">
<duet-card heading="Sidebar">Sidebar content</duet-card>
</div>
</duet-layout>
Open in new window
<duet-layout margin="none" center>
<div slot="main">
<duet-card heading="Main">Main content</duet-card>
<duet-card heading="More main content">Main content</duet-card>
</div>
</duet-layout>
Open in new window
<duet-layout center>
<div slot="top">
<duet-alert icon="messaging-alert">
A simple alert with an icon on left!
</duet-alert>
</div>
<div slot="main">
<duet-card heading="Main">Main content</duet-card>
<duet-card heading="More main content">Main content</duet-card>
</div>
</duet-layout>
</duet-layout>

Properties #

Property Attribute Description Type Default
center center Center align all direct children of this component. boolean false
margin margin Controls the margin of the component. "auto" | "none" "auto"
middle middle Align container vertically in the middle when the space allows it. boolean false
sticky sticky Makes the sidebar stick to the top of the window when scrolling down. boolean false
stickyDistance sticky-distance Adjust sticky sidebar’s distance to duet navigation component using this property. "with-links" | "without-links" "with-links"
tabs tabs If set to true, the sidebar position will be adjusted to take tabs inside main content area into account. boolean false

Slots #

Slot Description
"main" The layout component’s primary content. Use this for the main content on the page.
"sidebar" The layout component’s sidebar content. Use this for content that is related to the content in the main slot.
"top" This is a full-width content area above the main and sidebar slots. Could be used to show for example alert messages.

Usage #

This section includes guidelines for designers and developers about the usage of this component in different contexts.

When to use #

  • This component is mandatory when you have main content on a page.
  • To provide a structure for other components using a one or two column layout system.

When not to use #

  • When you need to a Flexbox based layout system. Use grid component instead.
  • When you need to stack multiple components horizontally. Use grid component instead.

Variations #

This section describes the different component variations, their purpose, and when to use each variation.

Name Purpose
full width This is the default variation when you only enter content into the main slot and don’t pass any additional properties. This variation is often used when listing insurance details or promotional banners. View an example.
narrow Narrow layout variation is often used in purchase flows when there is no need for a sidebar. View an example.
with sidebar Sidebar layout variation can be used when we need to display content information or pricing in a sticky sidebar on right. View an example.

Accessibility #

This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.


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

Abstract

Tutorials

Building Layouts

Tutorials

Using CLI Tools

Tutorials

Creating Custom Patterns

Tutorials

Server Side Rendering

Tutorials

Sharing Prototypes

Tutorials

Usage With Markdown

Tutorials

VS Code

Tutorials

Zeplin


Troubleshooting

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