🌍 NextJS · subject
NextJS Styling and UI Syllabus
Every chapter and topic of Styling and UI examined in NextJS — 3 chapters, 9 topics, plus 50 flashcards written against it.
Styling and UI syllabus — full chapter and topic list
Expand any chapter to see its topics and sub-topics. This is the whole examinable outline for Styling and UI in NextJS, not a summary of it.
-
CSS and Sass
3 topics- Global Styles
- CSS Modules
- Sass Integration
-
Styled Components
3 topics- Setup and Configuration
- Creating Styled Components
- Theming with Styled Components
-
Tailwind CSS
3 topics- Setup and Configuration
- Utility-First CSS
- Customizing Tailwind
Styling and UI flashcards for NextJS
24 of 50 cards from the Styling and UI deck — real questions with worked answers.
In a Next.js App Router project, where must global CSS be imported so it applies to the entire application?
In the root layout file (app/layout.tsx or .js). Global stylesheets can only be imported in the root layout, not in individual pages or components (in the App Router).
What is the conventional filename for the global stylesheet in a Next.js project?
app/globals.css (App Router) or styles/globals.css imported in pages/_app.js (Pages Router).
In the Next.js Pages Router, which single file is allowed to import a global CSS file, and why?
pages/_app.js (the custom App component). Global CSS affects every route, so Next.js restricts it to _app to avoid conflicts and ordering issues.
What error does Next.js throw if you import a plain global CSS file into a regular page or component (Pages Router)?
A 'Global CSS cannot be imported from files other than your Custom App' error, instructing you to move the import to pages/_app.js or convert it to a CSS Module.
What is a CSS Module in Next.js and how is it named?
A CSS file whose name ends in .module.css (e.g., Button.module.css). Its class names are automatically scoped locally to the component that imports it, preventing name collisions.
How do you consume a class from a CSS Module in a React/Next.js component?
Import it as an object (e.g., import styles from './Button.module.css') and reference classes as properties, such as className={styles.primary}.
How does Next.js guarantee CSS Module class names are unique across the app?
At build time it transforms each local class name into a unique hashed identifier (e.g., 'primary' becomes 'Button_primary__a1B2c'), scoping styles to that module.
Unlike global CSS, where can CSS Modules be imported in a Next.js app?
Anywhere: in any component or page. Because their scope is local, there is no risk of global conflicts, so Next.js allows them everywhere.
What is Sass and what two syntaxes does it provide?
Sass (Syntactically Awesome Style Sheets) is a CSS preprocessor. Its two syntaxes are SCSS (.scss, CSS-like with braces and semicolons) and the older indented syntax (.sass).
What single step is required to enable Sass support in a Next.js project?
Install the sass package (e.g., npm install --save-dev sass). Next.js has built-in Sass support once the compiler is present; no extra config is needed.
Can Sass be used together with CSS Modules in Next.js, and how are such files named?
Yes. Name the file with the .module.scss (or .module.sass) extension to get locally scoped, preprocessed styles (a SCSS Module).
Name three core features Sass adds on top of plain CSS.
Variables ($color), nesting of selectors, mixins/functions, partials with @use/@import, and inheritance via @extend.
In Sass, how do you declare and use a variable for a primary color?
Declare with a dollar sign: $primary: #0070f3; then reference it, e.g., color: $primary;.
Which Next.js config option lets you customize Sass, such as adding include paths or a global prepend?
The sassOptions key inside next.config.js (e.g., sassOptions: { includePaths: [...], prependData: '@use ...' }).
What is the recommended modern Sass rule for including another partial, and how does it differ from @import?
@use loads the partial with a namespace and loads it only once, avoiding duplication and global scope pollution. @import is deprecated because it dumps everything into the global namespace and can load files multiple times.
What is styled-components and which CSS-in-JS technique does it use?
A CSS-in-JS library that uses tagged template literals to write actual CSS scoped to a React component, generating unique class names at runtime.
Write the basic pattern for creating a styled button component with styled-components.
const Button = styled.button`\n color: white;\n background: blue;\n`; then render <Button>Click</Button>.
What is the styled-components tagged-template syntax used to style an existing component?
styled(Component)`...css...` — e.g., const FancyLink = styled(Link)`color: red;`. It wraps and extends the target component's styling by passing className.
How do you make styled-components render different styles based on a prop?
Interpolate a function that receives props inside the template literal, e.g., background: ${props => props.$primary ? 'blue' : 'gray'};.
Why do modern styled-components use a $ prefix on custom props (transient props) like $primary?
Transient props (prefixed with $) are consumed by styled-components for styling only and are NOT forwarded to the underlying DOM element, preventing invalid HTML attribute warnings.
What extra setup does styled-components require in the Next.js App Router for correct server-side rendering?
A style registry using ServerStyleSheet / useServerInsertedHTML in a client 'use client' component, plus enabling the compiler.styledComponents flag in next.config.js so styles are collected during SSR and no hydration mismatch occurs.
Which next.config.js compiler flag enables built-in SWC support for styled-components in Next.js?
compiler: { styledComponents: true }.
In styled-components, what does the createGlobalStyle helper do?
It creates a component that injects global CSS (like resets or html/body styles) into the document when rendered, since styled-components are normally scoped.
What is theming in styled-components and which component provides the theme?
Theming supplies a shared theme object (colors, fonts, spacing) to all styled components via the <ThemeProvider theme={theme}> context wrapper.
Planning Styling and UI for NextJS
Styling and UI is about 12% of the NextJS syllabus by topic count — 9 of 75 topics, spread over 3 chapters. At roughly 45 minutes per topic plus 12 minutes per sub-topic, a first pass runs to about 7 hours.
The heaviest chapters are CSS and Sass (3 topics), Styled Components (3 topics), Tailwind CSS (3 topics) . Front-load those while your energy is high; the short chapters are better revision filler later.
Work top-down: read the chapter, then tick topics off individually rather than marking the whole chapter done. Sub-topics are where silent gaps hide.
Styling and UI (NextJS) FAQ
What is in the NextJS Styling and UI syllabus?
Styling and UI is split into 3 chapters — CSS and Sass, Styled Components and Tailwind CSS, containing 9 topics and 0 sub-topics in total.
How is Styling and UI structured in the NextJS syllabus?
3 chapters. Styling and UI accounts for about 12% of the topics in the whole NextJS syllabus (9 of 75).
How long should I spend on Styling and UI for NextJS?
Budget around 7 hours for a first pass through Styling and UI — about 45 minutes per topic plus 12 minutes per sub-topic across its 9 topics. Add revision cycles on top.
Are there flashcards for NextJS Styling and UI?
Yes — a 50-card Styling and UI deck. Sample cards are printed on this page, and the full deck is free in the Examius app with spaced repetition scheduling.