Our great sponsors
-
next-typescript-tailwind-mdx-starter
Opinionated Next.js Starter with TypeScript, Tailwind, MDX, and decent SEO
-
next-themes
Perfect Next.js dark mode in 2 lines of code. Support System preference and any other theme with no flashing
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
If you don't have a Next.js + TailwindCSS site to work from, here's a github branch from my Next.js Tailwind Starter that is "pre-dark mode" that you can use.
There are several relatively complicated ways you might approach the problem of toggling themes. As with many things in the React.js and Next.js world, somebody else has already solved the problem very well, and for this the community favorite is next-themes which promises (and subsequently delivers) a "perfect dark mode in two lines of code".
The safelist allows you to specify classes that TailwindCSS will always keep around for you and not purge. At the time of this writing the only documentation for this is buried in some Github issue comments.
There are a lot of options for customizing the look and feel of your markdown. If you want some inspiration, Lee Rob has done a wonderful job for his personal site and you can check out the config here.
If you'd like to look more closely at a larger scale full-featured application (the one you are looking at right now in fact), you can checkout the repository for the egghead website on Github.
Related posts
- Build a Food Blog with Next.js, MDX, Tailwind CSS, and TypeScript
- Next.js and GPT-4: A Guide to Streaming Generated Content as UI Components
- New Project: What is a good framework for a website?
- Introducing Unreal Engine Directory – A Faster, Modern, Open Source Alternative to the UE Marketplace
- My portfolio built with Next.js, TypeScript, Firebase, and Vercel ✨