Late 2023, I had a crazy idea of building a set of layout patterns that can create any layout a developer needs.
So I started 2024 with this quest.
As I worked on it for a while, I realized that there are only four types of layouts.
ShelllayoutsMacrolayoutsMicrolayoutsPositioninglayouts
(I’m going to explain what each type of layout means in a bit, so bear with me for a while here).
My first version of this attempt ended up with copy-pasteable templates.
It could somewhat fulfill the idea of a set of layouts that any developer needs, but it cannot fulfill my second ambition, which is to be able to let a developer create flexible layouts on the fly.
So I went back to the drawing board…
And after testing a lot of things out for almost a year, I managed to create a set of utilities built on Tailwind that will cover most of your layout needs. It will allow you to create layouts in a very flexible manner, as I have displayed with grid-simple in the previous lesson.
This set of utilities is called Splendid Layouts
You can find the documentation of Splendid Layouts here.
For the rest of this Layouts module, I’m going to focus on talking about Splendid Layouts and the four kinds of layouts it can handle instead of diving into nitty-gritty Tailwind utilities, because I think that is the best use of our time together!
I will also be covering how to adjust various Tailwind configurations to make them more functional for building any layout you want.
Installing Splendid layouts
To use Splendid Layouts, you install @splendidlabz/styles and import the layouts.
npm install @splendidlabz/stylesYou need Tailwind installed as well. But I would recommend removing their preflight styles like this:
@layer theme, base, utilities.base, components, utilities;@import 'tailwindcss/theme.css' layer(theme);@import 'tailwindcss/utilities.css' layer(utilities);
/* Add Splendid Layouts */@import '@splendidlabz/styles/layouts';Now let me walk you through the 4 types of layouts so you can build them easily yourself.
Welcome! Unfortunately, you don’t have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson