0.0.54 • Published 2 years ago

@arjentienkamp/ngx-mat-calendar v0.0.54

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
2 years ago

Angular Calendar Component

This component displays a calendar in your Angular (Material) project.

Demo

Live demo

npm.io

Features

  • Display a day/week/month calendar with your events
  • Navigate between days/weeks/months, jump to today
  • Use a custom component for rendering events
  • Uses colors of your Material theme
  • Keyboard shortcuts
  • Call a function on event click
  • Call a function on add button click

Requirements

Installation and minimal setup

npm install @arjentienkamp/ngx-mat-calendar

Import the module:

@NgModule({
    imports: [
        NgxMatCalendarModule
    ]
})

Include the global SCSS file in your Angular app:

@import '../node_modules/@arjentienkamp/ngx-mat-calendar/src/lib/styles/_styles.scss';

Material basics

If you have not done this already, make sure to include the styles from Angular Material to your app's stylesheet, and also include the Roboto and Material Icons fonts in your app's index.html (alternatively, read how to setup Angular Material in your project here):

<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Also make sure the <body> tag has the mat-typoghrapy class:

<body class="mat-typography">

Calendar setup

Initiate default options:

this.calendarOptions = new CalendarOptions();

Or, change default options:

this.calendarOptions = new CalendarOptions({
    enableAddEventButton: false,
    view: WEEK
    // see CalendarOptions class for full list of options
});

Add the component to the template:

<ngx-mat-calendar
    [options]="calendarOptions"
    [events]="events"
    [selectedDate]="date"
    (eventClick)="handleEventClick($event)"
    (dateChange)="handleDateChange($event)"
    (addButtonClick)="handleAddButtonClick()">
</ngx-mat-calendar>

Inputs

PropertyDescriptionTypeRequired
optionsoptions have to be passed hereCalendarOptionstrue
eventsarray of events (i.e from API or other datasource)CalendarEvent[]true
selectedDatethe date for initiating the calendarDatetrue

Outputs

PropertyDescriptionType
eventClickemits when event is clickedEventEmitter<CalendarEvent>
dateChangeemits on date changeEventEmitter<Date>
addButtonClickemits on add button clickEventEmitter<any>

Todo

  • Unit tests
  • CalendarEvent class extendable for custom render component
  • Localization
  • Responsive

NPM package

NPM

Changelog

Changelog

License

GNU General Public License - Arjen Tienkamp

0.0.42

2 years ago

0.0.43

2 years ago

0.0.44

2 years ago

0.0.45

2 years ago

0.0.47

2 years ago

0.0.51

2 years ago

0.0.52

2 years ago

0.0.53

2 years ago

0.0.54

2 years ago

0.0.50

2 years ago

0.0.48

2 years ago

0.0.49

2 years ago

0.0.40

2 years ago

0.0.41

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.25

2 years ago

0.0.37

2 years ago

0.0.38

2 years ago

0.0.39

2 years ago

0.0.30

2 years ago

0.0.31

2 years ago

0.0.32

2 years ago

0.0.33

2 years ago

0.0.34

2 years ago

0.0.35

2 years ago

0.0.36

2 years ago

0.0.26

2 years ago

0.0.27

2 years ago

0.0.28

2 years ago

0.0.29

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago