{"id":13422990,"url":"https://github.com/asantibanez/livewire-calendar","last_synced_at":"2026-01-16T00:38:15.505Z","repository":{"id":37756446,"uuid":"264340842","full_name":"asantibanez/livewire-calendar","owner":"asantibanez","description":"Laravel Livewire component to show Events in a good looking monthly calendar","archived":false,"fork":false,"pushed_at":"2025-03-14T16:07:35.000Z","size":1123,"stargazers_count":921,"open_issues_count":34,"forks_count":235,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-03-14T16:35:10.283Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asantibanez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-16T02:14:18.000Z","updated_at":"2025-03-14T16:07:39.000Z","dependencies_parsed_at":"2024-01-14T23:57:06.474Z","dependency_job_id":"a3566067-995f-46d5-b730-98942c259602","html_url":"https://github.com/asantibanez/livewire-calendar","commit_stats":{"total_commits":33,"total_committers":3,"mean_commits":11.0,"dds":0.06060606060606055,"last_synced_commit":"21992f9eacd73dc603b5d9a7b0f7a194437a19bc"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asantibanez%2Flivewire-calendar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asantibanez%2Flivewire-calendar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asantibanez%2Flivewire-calendar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asantibanez%2Flivewire-calendar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asantibanez","download_url":"https://codeload.github.com/asantibanez/livewire-calendar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243614862,"owners_count":20319723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T23:01:04.977Z","updated_at":"2026-01-16T00:38:15.483Z","avatar_url":"https://github.com/asantibanez.png","language":"PHP","funding_links":[],"categories":["Calender","Components \u0026 Libraries","Packages / Plugins"],"sub_categories":[],"readme":"# Livewire Calendar\n\nThis package allows you to build a Livewire monthly calendar grid to show events for each day. Events can be loaded \nfrom within the component and will be presented on each day depending on the date of the event.\n\n## Preview\n\n![preview](https://github.com/asantibanez/livewire-calendar/raw/master/preview.gif)\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require asantibanez/livewire-calendar\n```\n\n## Requirements\n\nThis package uses `livewire/livewire` (https://laravel-livewire.com/) under the hood.\n\nIt also uses TailwindCSS (https://tailwindcss.com/) for base styling. \n\nPlease make sure you include both of this dependencies before using this component. \n\n## Usage\n\nIn order to use this component, you must create a new Livewire component that extends from \n`LivewireCalendar`\n\nYou can use `make:livewire` to create a new component. For example.\n``` bash\nphp artisan make:livewire AppointmentsCalendar\n```\n\nIn the `AppointmentsCalendar` class, instead of extending from the base `Component` Livewire class, \nextend from `LivewireCalendar`. Also, remove the `render` method. \nYou'll have a class similar to this snippet.\n \n``` php\nclass AppointmentsCalendar extends LivewireCalendar\n{\n    //\n}\n```\n\nIn this class, you must override the following method\n\n```php\npublic function events() : Collection\n{\n    // must return a Laravel collection\n}\n```\n\nIn the `events()` method, return a collection holding the events that will be displayed on \nthe calendar. Events must be keyed arrays holding at least the following keys: \n`id`, `title`, `description`, `date` (`date` must be a `Carbon\\Carbon` instance).\n\nExample\n\n```php\npublic function events() : Collection\n{\n    return collect([\n        [\n            'id' =\u003e 1,\n            'title' =\u003e 'Breakfast',\n            'description' =\u003e 'Pancakes! 🥞',\n            'date' =\u003e Carbon::today(),\n        ],\n        [\n            'id' =\u003e 2,\n            'title' =\u003e 'Meeting with Pamela',\n            'description' =\u003e 'Work stuff',\n            'date' =\u003e Carbon::tomorrow(),\n        ],\n    ]);\n}\n```\n\nThe `date` value will be used to determine to what day the event belongs to. To\nload values in the `events()` method, you can use the following component properties\nto filter your events.\n- `startsAt`: starting date of month   \n- `endsAt`: ending date of month   \n- `gridStartsAt`: starting date of calendar grid. Can be a date from the previous month.   \n- `endingStartsAt`: ending date of calendar grid. Can be a date from the next month.   \n\nExample\n\n```php\npublic function events(): Collection\n{\n    return Model::query()\n        -\u003ewhereDate('scheduled_at', '\u003e=', $this-\u003egridStartsAt)\n        -\u003ewhereDate('scheduled_at', '\u003c=', $this-\u003egridEndsAt)\n        -\u003eget()\n        -\u003emap(function (Model $model) {\n            return [\n                'id' =\u003e $model-\u003eid,\n                'title' =\u003e $model-\u003etitle,\n                'description' =\u003e $model-\u003enotes,\n                'date' =\u003e $model-\u003escheduled_at,\n            ];\n        });\n}\n```\n\nNow, we can include our component in any view. \n\nExample\n\n```blade\n\u003clivewire:appointments-calendar/\u003e\n``` \n\nThis will render a calendar grid.\n\n![example](https://github.com/asantibanez/livewire-calendar/raw/master/example.png)\n\nBy default, the component will render the current month. If you want to change the\nstarting month, you can set the `year` and `month` props.\n\n Example\n \n ```blade\n\u003clivewire:appointments-calendar\n    year=\"2019\"\n    month=\"12\"\n/\u003e\n ``` \n\nYou should include scripts with `@livewireCalendarScripts` to enable drag and drop which is turned on by default.\nYou must include them after `@livewireScripts`\n\n```blade\n@livewireScripts\n@livewireCalendarScripts\n``` \n\nThe component has 3 public methods that can help navigate forward and backward through months: \n- `goToPreviousMonth`\n- `goToNextMonth` \n- `goToCurrentMonth`\n\nYou can use these methods on extra views using `before-calendar-view` or `after-calendar-view` explained below.  \n\n### Advanced usage\n\n### Ui customization\n\nYou can customize the behavior of the component with the following properties when rendering on a view:\n\n- `week-starts-at` which can be a number from 0 to 6 according to Carbon days of week to indicate\nwith which day of week the calendar should render first. \n                          \n- `event-view` which can be any `blade.php` view that will be used to render the event card. \nThis view will be injected with a `$event` variable holding its data. \n\n- `before-calendar-view` and `after-calendar-view` can be any `blade.php` views that can be rendered before or after\nthe calendar itself. These can be used to add extra features to your component using Livewire.\n\n- `drag-and-drop-classes` can be any css class used to render the hover effect when dragging an event over each day\nin the calendar. By default, this value is `border border-blue-400 border-4` \n\n- `day-of-week-view` which can be any `blade.php` view that will be used to render the header of each calendar day.\nThis view will be injected the `day` property which is a Carbon instance of the day of the week.\n\n```blade\n\u003clivewire:appointments-grid\n    week-starts-at=\"0, 1, 2, 3, 4, 5 or 6. 0 stands for Sunday\"\n    event-view=\"path/to/view/starting/from/views/folder\"\n    day-of-week-view=\"path/to/view/starting/from/views/folder\"\n    before-calendar-view=\"path/to/view/starting/from/views/folder\"\n    after-calendar-view=\"path/to/view/starting/from/views/folder\"\n    drag-and-drop-classes=\"css classes\"\n/\u003e\n```\n\n### Advanced ui customization\n\n(This options should be used using blade views based on the component default views)\n\nTo use these options, it is recommended to publish the base blade views used by the component and extend their \nbehavior and styling to your liking. To do this, run `php artisan vendor:publish` and export the `livewire-calendar` tag.\n\n- `calendar-view` which can be any `blade.php` view that renders the whole component. It's advised to override this\nview with an altered copy of the base `calendar-view` eg adding a view next to the component.\n\n- `day-view` which can be any `blade.php` view that will be used to render each day of the month. This view will be \ninjected with the following properties: `componentId` (id of the Livewire component)\n, `day` (day of the month as a Carbon instance)\n, `dayInMonth` (if the day is part of the month or not)\n, `isToday` (if the day is today's date)\n, `events` (events collection that correspond to this day)\n\nExample\n\n```blade\n\u003clivewire:appointments-grid\n    calendar-view=\"path/to/view/starting/from/views/folder\"\n    day-view=\"path/to/view/starting/from/views/folder\"\n/\u003e\n```\n\n### Interaction customization\n\nYou can override the following methods to add interactivity to your component\n\n```php\npublic function onDayClick($year, $month, $day)\n{\n    // This event is triggered when a day is clicked\n    // You will be given the $year, $month and $day for that day\n}\n\npublic function onEventClick($eventId)\n{\n    // This event is triggered when an event card is clicked\n    // You will be given the event id that was clicked \n}\n\npublic function onEventDropped($eventId, $year, $month, $day)\n{\n    // This event will fire when an event is dragged and dropped into another calendar day\n    // You will get the event id, year, month and day where it was dragged to\n}\n```\n\n### Automatic polling\n\nYou can also add automatic polling if needed using `pollMillis` parameters. You can combo with `pollAction` in\norder to call a specific action in your component at the desired polling interval.\n\n### Disabling interactions\n\nBy default click and drag/drop events are enabled. To disable them you can use the following parameters when\nrendering the component\n```blade\n\u003clivewire:appointments-grid\n    :day-click-enabled=\"false\"\n    :event-click-enabled=\"false\"\n    :drag-and-drop-enabled=\"false\"\n/\u003e\n```\n\n### Testing\n\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email santibanez.andres@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Andrés Santibáñez](https://github.com/asantibanez)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasantibanez%2Flivewire-calendar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasantibanez%2Flivewire-calendar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasantibanez%2Flivewire-calendar/lists"}