1. Getting Started
  2. Frameworks
  3. Astro


Install Preline UI with Astro using Tailwind CSS

Setting up Preline UI in a Astro project using Tailwind CSS.


Please note that the plugin has been tested with the latest version of the framework (v3.5.7). The framework was installed using the standard npm create astro@latest command.
If you are using your own project structure, be mindful of file paths!

Quick Astro setup

Astro is the all-in-one web framework designed for speed. If you haven't set up Tailwind CSS yet, check out Astro Tailwind CSS installation guides.

Preline UI + Astro
  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.mjs file.

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

    Include Preline UI JavaScript to the projects_root_directory/src/layouts/Layout.astro file.

                            <!doctype html>
                            <html lang="en">
                            <script is:inline src="./assets/vendor/preline/preline.js"></script>