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 #
<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>
<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>
<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>
<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>
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 |
paddingBreakpoint | padding-breakpoint | Breakpoint used to remove padding. These match to similar media query tokens: $media-query-small and $media-query-medium. | "large" | "medium" | "small" | "x-large" | "x-small" | "xx-large" | "xx-small" | "xxx-large" | "xxx-small" | undefined |
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.
- Layout component uses
<main>
and<aside>
elements internally which are HTML sectioning elements that by default define ARIA landmark roles. For that reason you should never put layout component inside another HTML landmark.
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:
Building Layouts
TutorialsUsing CLI Tools
TutorialsCreating Custom Patterns
TutorialsServer Side Rendering
TutorialsSharing Prototypes
TutorialsUsage With Markdown
Troubleshooting
If you experience any issues while using a component, please head over to the Support page for more guidelines and help.