Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

marcellopato's avatar

Flowbite search not working at all

Have installed Flowbite on a Laravel 10 app, copied the code from Flowbite site which demands flowbite.js, but it is not working. Not using any other framework to frontend, just blade. Oh, I have Jetstream installed.

https://flowbite.com/docs/components/tables/#table-filter

Have followed all instructions, like: npm install flowbite

import './bootstrap';
import 'flowbite';

import hljs from 'highlight.js/lib/core';
import json from 'highlight.js/lib/languages/json';

hljs.registerLanguage('json', json);

document.addEventListener('DOMContentLoaded', () => {
    document.querySelectorAll('pre code').forEach((block) => {
        hljs.highlightElement(block);
    });
});
0 likes
17 replies
LaryAI's avatar
Level 58

It seems like you've installed Flowbite and are trying to use its table filter feature within a Laravel 10 application with Jetstream. Here are a few steps to ensure that Flowbite's JavaScript is working correctly:

  1. Ensure Flowbite is Installed: You've already run npm install flowbite, which is good. Make sure that it's listed in your package.json file under dependencies.

  2. Import Flowbite in Your JavaScript File: You've imported Flowbite in your JavaScript file, which is correct. Make sure this file is being compiled by Laravel Mix and included in your Blade layout.

  3. Compile Your Assets: After importing Flowbite, you need to compile your assets using Laravel Mix. Run the following command in your terminal:

    npm run dev
    

    or, if you're ready for production:

    npm run prod
    
  4. Include the Compiled JavaScript: Make sure that the compiled JavaScript file is included in your Blade layout. It should be something like this:

    <script src="{{ mix('/js/app.js') }}"></script>
    
  5. Initialize Flowbite: If Flowbite requires initialization, make sure you've included any necessary JavaScript to do so. However, as of my knowledge cutoff in early 2023, Flowbite components should be automatically initialized when you import flowbite.

  6. Check for JavaScript Errors: Open your browser's developer tools and check the console for any JavaScript errors. Errors could prevent Flowbite from working correctly.

  7. Ensure No Conflicts with Jetstream: Since you're using Jetstream, make sure there are no conflicts between Jetstream's JavaScript and Flowbite. Jetstream might come with its own version of Alpine.js or other scripts that could potentially conflict.

  8. Check the Flowbite Version: Ensure that the version of Flowbite you installed is compatible with the documentation you're following. Sometimes, documentation might be ahead of the latest stable release.

If you've done all of the above and it's still not working, here's a basic example of how you might include Flowbite's table filter in a Blade file:

<!DOCTYPE html>
<html lang="en">
<head>
    <!-- ... other head elements ... -->
</head>
<body>

<!-- Your table with the data-flowbite-table attribute -->
<table data-flowbite-table>
    <!-- ... your table markup ... -->
</table>

<!-- Include the compiled JS file -->
<script src="{{ mix('/js/app.js') }}"></script>

</body>
</html>

If you're still facing issues, please provide more specific information about what's not working, such as error messages or unexpected behavior, so that the community can assist you further.

marcellopato's avatar

Don't need to use

<script src="{{ mix('/js/app.js') }}"></script>

since I am using Livewire which uses

        @vite(['resources/css/app.css', 'resources/js/app.js'])
gych's avatar

I have experience with Flowbite but not combined with Livewire. Have you tried to test if it works if you just use the Flowbite cdn?

marcellopato's avatar

@gych yes, I did. In truth looks like it is working 'cause I made a test following another tutorial with a menus and it does work without errors. The problem here is the search at the right corner of this table mentioned on my post... it does not work... can't say if it needs or not some coding... Have you tried this search?

gych's avatar
gych
Best Answer
Level 29

@marcellopato The search won't work by just adding the flowbite element. You'll have to connect it with your back-end controller to execute the search and retrieve the results.

1 like
marcellopato's avatar

@gych boomer... I thought it works like Yajdra DataTables... well, back to the project board! Thanks man!

1 like
sforshoaib's avatar

@gych hey, I am facing some problem with flowbite and jetstream on laravel 10. When i install flowbite on fresh laravel it works like charm. but as soon I install jetstream with livewire bundle my flowbite buttons and someother stuff looses styling. I have cross checked tailwind.config.js all looks right. I don't know what I am missing? Can you help here is the tailwind.config.js code.

import defaultTheme from 'tailwindcss/defaultTheme';
import forms from '@tailwindcss/forms';
import typography from '@tailwindcss/typography';

/** @type {import('tailwindcss').Config} */
export default {
    content: [
        './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
        './vendor/laravel/jetstream/**/*.blade.php',
        './storage/framework/views/*.php',
        "./resources/**/*.blade.php",
        "./resources/**/*.js",
        "./node_modules/flowbite/**/*.js",
    ],
    darkMode: 'class',
    theme: {
        extend: {
            fontFamily: {
                sans: ['Figtree', ...defaultTheme.fontFamily.sans],
            },
        },
    },

    plugins: [
        forms,
        typography,
        require('flowbite/plugin'),
    ],
};

gych's avatar

@sforshoaib Your tailwind config looks right but sadly I don't have a lot of experience using livewire with flowbite.

I advise you to create a new thread on this forum for your issue, maybe others that have more experience with livewire can help.

1 like
marcellopato's avatar

@sforshoaib it happened to me sometimes, even running npm run dev && npm run build. Can't say why yet...

1 like
sforshoaib's avatar

@gych and @marcellopato thanks for your response. You are right, config was right, but i missed flowbite classes to include in tailwind.config.js actually flowbite created some extra classes for there components to render. here is the actual config file code. I installed flowbite first than jetstream, while installation jetstream resets tailwind.config.js file. I hope this information might help others

import defaultTheme from 'tailwindcss/defaultTheme';
import forms from '@tailwindcss/forms';
import typography from '@tailwindcss/typography';

/** @type {import('tailwindcss').Config} */
export default {
    content: [
        './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
        './vendor/laravel/jetstream/**/*.blade.php',
        './storage/framework/views/*.php',
        './resources/views/**/*.blade.php',
        "./resources/**/*.blade.php",
        "./resources/**/*.js",
        "./node_modules/flowbite/**/*.js"
    ],
    darkMode: 'class',
    theme: {
        extend: {
            colors: {
                primary: {"50":"#eff6ff","100":"#dbeafe","200":"#bfdbfe","300":"#93c5fd","400":"#60a5fa","500":"#3b82f6","600":"#2563eb","700":"#1d4ed8","800":"#1e40af","900":"#1e3a8a","950":"#172554"}
              },
            fontFamily: {
                sans: ['Figtree', ...defaultTheme.fontFamily.sans],
            },
        },
    },
    plugins: [
        forms,
        typography,
        require('flowbite/plugin')
    ],
};
gych's avatar

@sforshoaib Good that you managed to solve it. You always have to install Laravel starter kits Breeze and Jetstream directly after installing a new Laravel application.

Once you install it later it replaces some files and can cause some unexpected issues like you've now experienced.

1 like
StradiMarius's avatar

@gych @sforshoaib

I'm having the same issue, I actually built a project in Laravel 11 I added the breeze package way too long after I created the project and encouteer many issues..

This is my tailwind.config.js and I'm not sure if evrything is it at the right place, some of my js functions are not working properly like the darkmode, popup or animate fade etc..

import defaultTheme from 'tailwindcss/defaultTheme';
import forms from '@tailwindcss/forms';

/** @type {import('tailwindcss').Config} */
export default {
    content: [
        './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
        './storage/framework/views/*.php',
        './resources/views/**/*.blade.php',

    ],

    theme: {
        extend: {
            fontFamily: {
                sans: ['Figtree', ...defaultTheme.fontFamily.sans],
            },
        },
    },

    plugins: [forms],
};

module.exports = {
    darkMode: 'class',
    content: [
        "./resources/**/*.blade.php",
        "./resources/**/*.js",
        "./resources/**/*.vue",
        "./node_modules/flowbite/**/*.js"
    ],
    theme: {
        extend: {
            colors: {
                primary: {
                    50: "#eff6ff",
                    100: "#dbeafe",
                    200: "#bfdbfe",
                    300: "#93c5fd",
                    400: "#60a5fa",
                    500: "#3b82f6",
                    600: "#2563eb",
                    700: "#1d4ed8",
                    800: "#1e40af",
                    900: "#1e3a8a",
                    950: "#172554",
                },
                fontFamily: {
                    body: [
                        "Inter",
                        "ui-sans-serif",
                        "system-ui",
                        "-apple-system",
                        "system-ui",
                        "Segoe UI",
                        "Roboto",
                        "Helvetica Neue",
                        "Arial",
                        "Noto Sans",
                        "sans-serif",
                        "Apple Color Emoji",
                        "Segoe UI Emoji",
                        "Segoe UI Symbol",
                        "Noto Color Emoji",
                    ],
                    sans: [
                        "Inter",
                        "ui-sans-serif",
                        "system-ui",
                        "-apple-system",
                        "system-ui",
                        "Segoe UI",
                        "Roboto",
                        "Helvetica Neue",
                        "Arial",
                        "Noto Sans",
                        "sans-serif",
                        "Apple Color Emoji",
                        "Segoe UI Emoji",
                        "Segoe UI Symbol",
                        "Noto Color Emoji",
                    ],
                }

            },
        },


    },
    plugins: [
        require('flowbite/plugin'),
        require('flowbite-typography')
    ],

}
gych's avatar

@StradiMarius You are using both module exports and export default in the tailwind config which might be the cause of the issues you're experiencing.

When installing Breeze at a later stage when developing your application it can cause a lot of unexpected issues. Most of the times its better to start a new application with Breeze and move your existing files like views, controllers, models, etc. to that new application.

Hasith's avatar

@gych @sforshoaib @marcellopato @StradiMarius

I'm having the same issue. I built a project in Laravel 11 using the Livewire Jetstream Starter Kit. Then, I configured some external packages such as Wireui, Filament, and MaryUi. When I tried to install Flowbite, the CSS worked, but the Flowbite JS did not. This is my tailwind.config file, and I also added import "flowbite"; to the app.js file.

import defaultTheme from "tailwindcss/defaultTheme";
import forms from "@tailwindcss/forms";
import typography from "@tailwindcss/typography";
import wireuiConfig from "./vendor/wireui/wireui/tailwind.config.js";
import filamentConfig from "./vendor/filament/support/tailwind.config.preset";
const colors = require("tailwindcss/colors");

/** @type {import('tailwindcss').Config} */
export default {
    presets: [wireuiConfig, filamentConfig],
    darkMode: "class",
    content: [
        "./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php",
        "./vendor/laravel/jetstream/**/*.blade.php",
        "./storage/framework/views/*.php",
        "./resources/views/**/*.blade.php",
        "./resources/**/*.blade.php",
        "./resources/**/*.js",
        "./node_modules/flowbite/**/*.js",
        "./vendor/robsontenorio/mary/src/View/Components/**/*.php",
        "./app/Filament/**/*.php",
        "./resources/views/filament/**/*.blade.php",
        "./vendor/filament/**/*.blade.php",
        "./vendor/wireui/wireui/src/*.php",
        "./vendor/wireui/wireui/ts/**/*.ts",
        "./vendor/wireui/wireui/src/WireUi/**/*.php",
        "./vendor/wireui/wireui/src/Components/**/*.php",
    ],
    theme: {
        extend: {
            colors: {
                primary: colors.amber,
                secondary: colors.gray,
                positive: colors.emerald,
                negative: colors.red,
                warning: colors.amber,
                info: colors.blue,
            },
            fontFamily: {
                sans: ["Figtree", ...defaultTheme.fontFamily.sans],
            },
        },
    },
    daisyui: {
        themes: [
            {
                light: {
                    ...require("daisyui/src/theming/themes")["light"],
                    primary: "#f59e0b",
                },
                dark: {
                    ...require("daisyui/src/theming/themes")["dark"],
                    primary: "#f59e0b",
                },
            },
        ],
    },
    plugins: [
        forms,
        typography,
        require("daisyui"),
        require("flowbite/plugin"),
    ],
};
Hasith's avatar

Since I started using Livewire 3 and Full Page components, I found a simple solution for the JS issue. Follow the installation steps mentioned in the Flowbite Doc. After that By using the AlpineJS init method at the top of each Full Page component, Flowbite JS works perfectly.

<div x-init="initFlowbite();"></div>

Please or to participate in this conversation.