Skip to content

Custom commands #97

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Custom commands #97

wants to merge 2 commits into from

Conversation

WickyNilliams
Copy link
Owner

@WickyNilliams WickyNilliams commented Jun 4, 2025

Experimenting with adding custom commands: https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/command

With this, you can now do things like:

<button commandfor="date" command="--previous">Previous</button>
<button commandfor="date" command="--next">Next</button>
<button commandfor="date" command="--today">Today</button>

<calendar-date id="date">
  <calendar-month></calendar-month>
</calendar-date>

Letting you wire up functionality without any JS! It's only supported in Chrome right now, but it easily polyfilled, see here

Warning

When support for command is good enough, I am considering making this the default way to navigate pages i.e. cally will no longer render its own "previous" and "next" buttons.

This would of course be part of a major release since it would be a breaking change

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