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

Pickers modal display plugin #608

Draft
wants to merge 5 commits into
base: v2-dev
Choose a base branch
from

Conversation

gselderslaghs
Copy link
Member

Proposed changes

Implements a modal display plugin in timepicker and datepicker components

Timepicker example:

document.addEventListener('DOMContentLoaded', function() {
    const timepickerEl = document.querySelector('.timepicker');
    const title = document.createElement('h4');
    title.innerText = 'Select time';

    M.Timepicker.init(timepickerEl, {
        autoSubmit: true,
        showClearBtn: false,
        displayPlugin: 'modal',
        displayPluginOptions: { title }
    });
});

Datepicker example:

document.addEventListener('DOMContentLoaded', function() {
    const datepickerEl = document.querySelector('.datepicker');
    const title = document.createElement('h4');
    title.innerText = 'Select date';

    M.Datepicker.init(datepickerEl, {
        autoSubmit: true,
        showClearBtn: true,
        displayPlugin: 'modal',
        displayPluginOptions: { title }
    });
});

Screenshots (if appropriate) or codepen:

Screenshot 2025-03-06 at 13 50 20 Screenshot 2025-03-06 at 13 52 04

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to change).

Checklist:

  • I have read the CONTRIBUTING document.
  • My commit messages follows the conventional commit format
  • My change requires a change to the documentation, and updated it accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@gselderslaghs gselderslaghs marked this pull request as draft March 12, 2025 09:57
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

Successfully merging this pull request may close these issues.

1 participant