Shell Grid
Shell-grid
creates a layout with a header, left sidebar, main content area, and right sidebar. The main content expands to fill available space, and the sidebars’ width are adjustable.
-->
Shell-grid
creates a layout with a header, left sidebar, main content area, and right sidebar. The main content expands to fill available space, and the sidebars’ width are adjustable.
Just use Shell-grid
along with LeftSidebar
, Content
, and RightSidebar
classes to create your layout.
Omit header
and RightSidebar
elements to create a layout with just the LeftSidebar
and Content
.
LeftSidebar
, Content
, and RightSidebar
containers automatically add scrollbars when their contents exceed the container height.
Create a mobile-friendly layout using our Drawer
component and Tailwind’s responsive variants.
Resize this demo to see the mobile layout in action!
Shell-grid
uses CSS Grid to create a layout with four elements:
header
.LeftSidebar
.Content
.RightSidebar
The header
and RightSidebar
are optional, while LeftSidebar
and Content
are required.
You can modify the widths of Content
, LeftSidebar
, and RightSidebar
using CSS variables. The default values are as follows:
Creating responsive shell layouts can be challenging, but we’ve simplified the process using Drawer
and Tailwind responsive variants.
To create a responsive layout, you need to:
DrawerTrigger
and DrawerContent
that only appear on mobile.DrawerContent
.LeftSidebar
on mobile.Content
full width on mobile.There are three ways to implement this:
Shell-grid
.Shell-simple
on mobile and Shell-grid
on desktop.To only use Shell-grid
, adjust --span
for Content
to span 2 columns on mobile.
This works because the CSS Grid we designed contains two columns when there is
no RightSidebar
. (If you have RightSidebar
as well, you need to set
--span
to 3
).
This approach is slightly simpler. Here, you start with Shell-simple
on mobile and switch to Shell-grid
on desktop with responsive variants. The key steps mentioned earlier still apply.
You can use media queries or container queries to handle all the steps mentioned in the key steps section.
We don’t recommend this approach as it requires more code than the other methods. Unfortunately, we can’t simplify this further because we can’t predict which breakpoint you’ll use.
To create a sticky sidebar within Content
(like the one on this page), create a grid within Content
and use Sticky
for the sidebar.
Splendid Labz is free because we love developers and we want to contribute back to the ecosystem.
We only charge for access to the documentation to keep the project going. If you don't wish to pay, feel free to use the content from the features tab, our blogs or our videos as your guide.
Shell-grid
uses CSS Grid to create a layout with four elements:
header
.LeftSidebar
.Content
.RightSidebar
The header
and RightSidebar
are optional, while LeftSidebar
and Content
are required.
You can modify the widths of Content
, LeftSidebar
, and RightSidebar
using CSS variables. The default values are as follows:
Creating responsive shell layouts can be challenging, but we’ve simplified the process using Drawer
and Tailwind responsive variants.
To create a responsive layout, you need to:
DrawerTrigger
and DrawerContent
that only appear on mobile.DrawerContent
.LeftSidebar
on mobile.Content
full width on mobile.There are three ways to implement this:
Shell-grid
.Shell-simple
on mobile and Shell-grid
on desktop.To only use Shell-grid
, adjust --span
for Content
to span 2 columns on mobile.
This works because the CSS Grid we designed contains two columns when there is
no RightSidebar
. (If you have RightSidebar
as well, you need to set
--span
to 3
).
This approach is slightly simpler. Here, you start with Shell-simple
on mobile and switch to Shell-grid
on desktop with responsive variants. The key steps mentioned earlier still apply.
You can use media queries or container queries to handle all the steps mentioned in the key steps section.
We don’t recommend this approach as it requires more code than the other methods. Unfortunately, we can’t simplify this further because we can’t predict which breakpoint you’ll use.
To create a sticky sidebar within Content
(like the one on this page), create a grid within Content
and use Sticky
for the sidebar.
Here’s the CSS for Shell-grid
. We wrote this with Sass.
Splendid Labz is free because we love developers and we want to contribute back to the ecosystem.
We only charge for access to the documentation to keep the project going. If you don't wish to pay, feel free to use the content from the features tab, our blogs or our videos as your guide.
Here’s the CSS for Shell-grid
. We wrote this with Sass.
Children elements | Description |
---|---|
header | Header |
.Content | Main Content |
.LeftSidebar | Left Sidebar |
.RightSidebar | Right Sidebar |
CSS Variables | Default Value | Description |
---|---|---|
--content-width | 1fr | Width of the content |
--lsb-width | auto | Width of the left sidebar |
--rsb-width | auto | Width of the right sidebar |
CSS Variables | Default Value | Description |
---|---|---|
--span | 1 | Determines the number of columns a children should span. This can be used on Content , LeftSidebar and RightSidebar . |
Splendid Labz is free because we love developers and we want to contribute back to the ecosystem.
We only charge for access to the documentation to keep the project going. If you don't wish to pay, feel free to use the content from the features tab, our blogs or our videos as your guide.
Children elements | Description |
---|---|
header | Header |
.Content | Main Content |
.LeftSidebar | Left Sidebar |
.RightSidebar | Right Sidebar |
CSS Variables | Default Value | Description |
---|---|---|
--content-width | 1fr | Width of the content |
--lsb-width | auto | Width of the left sidebar |
--rsb-width | auto | Width of the right sidebar |
CSS Variables | Default Value | Description |
---|---|---|
--span | 1 | Determines the number of columns a children should span. This can be used on Content , LeftSidebar and RightSidebar . |