I am trying to get the Datepicker tailwind elements component to work in React, but for some reason it is not triggering: https://tailwind-elements.com/docs/standard/forms/datepicker/
I have followed the steps in the tailwind elements quick start guide: https://tailwind-elements.com/quick-start/
Here is my current set up:
tailwind.config.js:
module.exports = {
content: ['./src/**/*.{html,js,jsx,ts,tsx}', './node_modules/tw-elements/dist/js/**/*.js', './public/index.html'],
plugins: [require('tailwind-scrollbar-hide'), require('tw-elements/dist/plugin')],
};
craco.config.js:
module.exports = {
style: {
postcss: {
plugins: [require('tailwindcss'), require('autoprefixer')]
}
}
};
index.js:
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import store from './state/store';
import { Provider } from 'react-redux';
import 'tw-elements';
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);
I have also tried the following:
- Importing 'tw-elements' in my top level App.js file as well as the actual component I'm using the datepicker in.
- Linking the script in my index.html as it mentions in the quick start guide. I have tried linking it in the following ways:
<script src="./TW-ELEMENTS-PATH/dist/js/index.min.js"></script>
<script src="../node_modules/tw-elements/dist/js/index.min.js"></script>
<script src="./index.min.js"></script> // after copying the file into the same directory as index.html
The styles for the datepicker get applied, but the javascript code to pop up the datepicker just doesn't seem to be getting triggered. Any thoughts on what the issue could be? Let me know if anymore information would be helpful.