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

Setting options when using Livewire #28

Open
blunde opened this issue Nov 30, 2023 · 1 comment
Open

Setting options when using Livewire #28

blunde opened this issue Nov 30, 2023 · 1 comment

Comments

@blunde
Copy link

blunde commented Nov 30, 2023

How can I set options on a datepicker that is already initialized ?

Using Laravel 10, Livewire 3, npm

@cinderjk
Copy link

The documentation is clear, you just need extra code to enable in livewire 3

page.blade.php

<script data-navigate-once>
    document.addEventListener('livewire:navigated', () => {
        const Datepicker = document.getElementById('date');

        if (!Datepicker) return;

        new Datepicker(Datepicker, {
            format: 'yyyy/mm/dd',
            buttons: true, // not working
            autohide: true,
            title: 'This is a datepicker',
        }); 
    });
</script>

app.js

import Datepicker from 'flowbite-datepicker/Datepicker';

window.Datepicker = Datepicker;

Livewire.start()

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

2 participants