Install Preline UI with Next.js using Tailwind CSS

Setting up Preline UI in a Next.js project using Tailwind CSS.

Quick Next.js setup

The React Framework for the Web. If you haven't set up Tailwind CSS yet, check out Next.js Tailwind CSS installation guides.

Preline UI + Next.js
  1. Install Preline UI

    Install preline via npm or yarn.

    // Terminal or Shellnpm install preline // or yarn add preline
  2. Configure Preline UI JavaScript paths

    Add the path to Preline UI JavaScript files in your tailwind.config.js file.

    // tailwind.config.jsmodule.exports = {  content: [      'node_modules/preline/dist/*.js',  ],  plugins: [      require('preline/plugin'),  ],}
  3. Add the Preline UI JavaScript

    Add the Preline UI JavaScript in your app entry point _app.tsx or _app.js according to the Next.js version.

    // _app.tsx or _app.js'use client;'...useEffect(() => {
    }, [])...