Composing Layouts in React
In this course we show you how to build complex layouts in React by composing just a few foundational layout primitives. Along the way you will learn modern CSS Layout tools like Normal Flow, Flexbox, and Grid.
What You Will Learn
What it means to compose layouts and why you should do it
How to apply the principles of Encapsualted CSS in our React components
The foundational layout primitives that every developer should know
CSS layout has grown and evolved into a robust set of tools to accomplish some fantastic modern layouts. The problem is that we are still teaching CSS as something that is" hacked" together by using" tricks" to get our desired web layouts. Learning CSS like this typically leads us down one of two paths: We either build fragile page layouts using the "see what sticks" method of CSS, or we give up and declare that CSS is too tricky and bring in an X column grid system like Twitter Bootstrap.
Creating page layouts in CSS doesn't have to be complicated. Like how you make much of your everyday speech using just a small subset of vocabulary composed together, you can achieve sophisticated layouts by composing simple low-level layout primitives in unique ways.
In this course, you will learn foundational layout primitives that you can use to build many of your more complex layouts. You will also learn how to apply the principle of "Encapsulated CSS" to both extend these primitives as well as to create custom layout primitives. To do this, we will recreate many of the layouts found in the wild using the principles mentioned above.
This course does not require extensive knowledge of CSS. It does assume that you have a basic understanding of the CSS box model, CSS specificity, CSS selectors, and CSS sizing units. Though you can apply the principles in this course to any modern web framework, including no framework development, this course will be using React and assume you have a basic understanding of React, JSX, and React hooks.
Composing Layout in React is for both novice and experienced developers who want to take their layout skills to the next level. This course will teach you the practical skills you need to build modern layouts for the web without depending on heavy CSS frameworks. Unlike courses and blog posts that teach each layout property in isolation, our product teaches practical layout patterns that you can use every day when solving your layout challenges.
CSS In The Age of Components
Using CSS in this age of components is difficult, especially where web layout is concerned. In this module, you will learn the rules to be able to build composable layouts.
Complex layouts can be broken down into smaller layout primitives that can be combined to build more complex structures. Thinking compositionally will open up a more practical and reusable way of creating layouts on the web.
Knowing where to place your styles is critical to understanding composable layouts. Using the Principles of Encapsulated CSS you will know exactly how to apply your layout styles in your components.
Normal Flow as Composable Layouts
In the lesson, you will learn about Normal Flow and what patterns you can use to apply the principle of Encapsulated CSS in the context of Normal Flow.
CSS Flexbox and CSS Grid as Composable Layouts
You will learn the basics of CSS Flexbox and CSS Grid, especially which properties conform to the Encapsulated CSS principles and which ones do not.
A CSS Reset For Composable Layouts
In this lesson you will learn how to reset the default browser styles so that they follow Encapsulated CSS.
Layout Primitives - The Spacers
Introduction to layout spacers
An Introduction to layout spacers
The Stack Component
The Stack layout pattern is one of the most simple and common layout patterns on the web. In this lesson, you will learn how to build the Stack primitive and how to make it configurable for your situation
The Split Component
The layout challenge that is as old as the web itself is putting two items next to each other. In this lesson, you will learn how to build the Split primitive to solve this problem.
Columns and Column Component
Having a column-based grid system to lay our elements out on is very useful, which is why Bootstrap and other CSS frameworks are built on that model. In this lesson, you will learn how to build the Columns primitive and its helper the Column to build your custom column layout.
The Grid Component
Building an inherently responsive grid of items has been reduced down into a single line of CSS. In this lesson, you will learn how to build the Grid primitive that easily lets us achieve this layout.
Text in a paragraph is one of the best examples of "responsive by default." Text will wrap and cluster according to the text alignment. In this lesson, we will learn how to achieve that same effect using the InlineCluster primitive.
Clustering is one way to do responsive inline layouts, but sometimes we want to switch the direction that the items are flowing when we cross a certain threshold. In this lesson, we will learn how to build the Inline primitive that does just that.
Layout Primitives - The Wrappers
Introduction to Layout Wrapper Primitives
Introduction to layout wrapper primitives
The PadBox Component
In this lesson, you will learn how to build the PadBox primitive and use it in a Pricing Plan component.
The Center Component
In this lesson, we will be creating a Center layout primitive that centers itself and its children.
The Frame Component
In this lesson, we will build the Frame primitive, which frames out a visual media, like an image or video, and forces it into the aspect ratio needed for the design without distorting the image.
The Cover Component
In this lesson, we will learn how to build the Cover primitive, which will vertically center its children and allow you to inject a top or a bottom section around it.
The Hero Section Revisited
Let's revisit the Hero section from Module 1 and build it for real using the primitives we have learned.
Composing Layouts in Practice
Introduction to The Settings Pages
Introduction to settings pages
The Menu and Header
This lesson is going to focus on getting the menu and header completed on our mock Settings Page
The Main and SideBar
This lesson will focus on getting the main section with the sidebar navigation for our Settings page.
The Profile Pane
In this lesson, we will be focusing on the profile pane.
The Privacy Pane
In this lesson, we will be finishing the Settings page by completing the privacy pane.
Frequently Asked Questions
Who is this course for?
Composing Layout in React is for both novice and experienced developers who want to take their layout skills to the next level
What if I need help?
You can ask us questions anytime through the community Discord channel, #composing-layouts-in-react, or by sending us a message.
25 lessons (4h 52m)
1 complete project
1,035 lines of code