Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use Flowbite in angular project?

I want to use Flowbite in my project.I did the following steps but it still doesn't work.

  1. I installed the tailwind first, Tailwind is working fine now.

  2. Then I installed Flowbite using npm, and add Flowbite as a plugin inside the tailwind.config.js file. Base on this link: https://flowbite.com/docs/getting-started/quickstart/

    npm i flowbite

tailwind.config.js file ‍‍‍‍‍

module.exports = {
  content: [
    "./src/**/*.{html,ts}",
    "./node_modules/flowbite/**/*.js"
  ],
  theme: {
    extend: {},
  },
  plugins: [require('flowbite/plugin')]
}

angular.js file ‍‍‍‍‍

"architect": {
   "build": {
     "options": {
        "scripts": ["node_modules/flowbite/dist/flowbite.js"]
     },
}

I even used the package below, but it still doesn't work.

flowbite-angular

https://www.npmjs.com/package/flowbite-angular

like image 658
Hossein Bajan Avatar asked Jan 19 '26 18:01

Hossein Bajan


2 Answers

I ran into this issue recently, and what I did was to implement mine slightly based on Vue's implementation.

  1. npm i flowbite --save
  2. Import the function needed for the component to work
import {
  initAccordions,
  initCarousels,
  initCollapses,
  initDials,
  initDismisses,
  initDrawers,
  initDropdowns,
  initModals,
  initPopovers,
  initTabs,
  initTooltips,
} from 'flowbite';

export class HomeComponent implements OnInit {
  constructor() {}

  ngOnInit(): void {
    initAccordions();
    initCarousels();
    initCollapses();
    initDials();
    initDismisses();
    initDrawers();
    initDropdowns();
    initModals();
    initPopovers();
    initTabs();
    initTooltips();
  }
}

You can also choose to import flowbite in tailwind.config.js, but it made no difference for me.

like image 140
PIE Avatar answered Jan 21 '26 08:01

PIE


You can directly clone this flowbite-angular open source library and start using the UI components from it after importing the respective library modules. As af now flowbite is not fully developed for Angular, we do not have solution for some components which are not covered in this library.

like image 31
Divya T Avatar answered Jan 21 '26 09:01

Divya T



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!