The New Way to Build! Introducing ReUI — the developer platform for agentic UI with shadcn/ui
Learn More

About Tailwind CSS Date Picker


i use SPA, how to init Date Picker when it load false. like other
KTSelect.getOrCreateInstance(selectElement)
Or KTSelect.init()


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)

Technology discussions often emphasize the value of good planning, organization, and tools that make complex tasks easier to manage. The same idea applies to travel, where proper scheduling and reliable services can make a significant difference in the overall experience. For journeys that involve multiple destinations and important timings, dependable transportation helps everything run more smoothly. Well-organized travel arrangements, supported by Professional Umrah Drivers, can reduce stress, improve convenience, and allow travelers to focus on the purpose of their journey rather than the logistics.

Hi Xin Yu,

Understanding

You're using Metronic 9 in a SPA setup and need to manually initialize the DatePicker after dynamic content loads — similar to how KTSelect.getOrCreateInstance() or KTSelect.init() works.

Solution

The DatePicker auto-initializes on page load for elements with data-kt-date-picker="true". For SPA, the approach depends on your framework:

If using Livewire: KTUI already has built-in support — it listens for livewire:navigate events and re-initializes all components automatically. No extra code needed.

For other SPA frameworks (Vue Router, React Router, Inertia, etc.): After your route change completes and the new DOM is rendered, you can re-trigger initialization by calling:

// Re-init all KTUI components (including Select, Modal, etc.)
KTComponents.init();

To interact with an existing DatePicker instance (e.g. after it's initialized):

const picker = KTDatePicker.getInstance(document.getElementById('my-date-picker'));
picker.show();   // open calendar
picker.hide();   // close calendar
picker.reset();  // clear selection
const dates = picker.getSelectedDates();
const calendar = picker.getCalendar(); // underlying vanilla-calendar-pro instance

Note: KTDatePicker is part of the Metronic template (not the open-source KTUI library), so getOrCreateInstance may or may not be available — check your Metronic source for the exact static methods.

Sources

Next Steps

If KTComponents.init() doesn't pick up your dynamically added DatePicker, check the Metronic template source for a KTDatePicker.init() or KTDatePicker.createInstances() static method. You can also try calling it after a short requestAnimationFrame delay to ensure the DOM is fully settled.


This reply was generated by AI. A human will follow up if needed.

Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(