Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error when trying to use Modal #526

Closed
erichi opened this issue Apr 11, 2023 · 3 comments
Closed

Getting error when trying to use Modal #526

erichi opened this issue Apr 11, 2023 · 3 comments

Comments

@erichi
Copy link

erichi commented Apr 11, 2023

I'm trying to implement modal example from your docs in my Rails 7 + Hotwired Stimulus + Flowbite (turbo) stack.
Here is my stimulus controller

import { Controller } from "@hotwired/stimulus"
import { Modal } from 'flowbite';

export default class extends Controller {
  connect() {
  }

  showStoryItem(event) {
    const $targetEl = event.target;

    // options with default values
    const options = {
      placement: 'bottom-right',
      backdrop: 'dynamic',
      backdropClasses: 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40',
      closable: true,
      onHide: () => {
          console.log('modal is hidden');
      },
      onShow: () => {
          console.log('modal is shown');
      },
      onToggle: () => {
          console.log('modal has been toggled');
      }
    };

    const modal = new Modal($targetEl, options);
    modal.show();
  }
}

When I open this page i'm getting error
SyntaxError: The requested module 'flowbite' does not provide an export named 'Modal'

Flowbite js works on dropdowns and etc though

Can you help please?

@erichi erichi closed this as completed Apr 12, 2023
@Alxzu
Copy link

Alxzu commented Apr 21, 2023

@erichi can you share your solution?

@erichi
Copy link
Author

erichi commented Apr 21, 2023

I've just copied Modal module from the repo to my project and imported from there.

@hs-dliaska
Copy link

seems a lot of people has this issue #88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants