🚧 Please bear with us until the 1.0.0 release 🚧
Header Component

Header Component

Description

The HeaderComponent defines how the large banner at the top of the calendar appears. It can include as many or as few controls as you want.

The following example displays how to create a custom Header component. You aren't required to create an HeaderComponent unless you want to override the default version.

Example (DefaultHeader)

import 'schedulely/dist/index.css';
import { DefaultHeader } from './HeaderExample';

export default function App() {
    return (
      //wrapper div so example works correctly
      <div className="schedulely" style={{border: '1px dashed black'}}>
        <DefaultHeader 
          month={'January'}
          year={2008}
          isCurrentMonth={false}
          onNextMonth={()=>console.log('next month')} 
          onNextYear={()=>console.log('next year')}
          onPrevMonth={()=>console.log('prev month')}
          onPrevYear={()=>console.log('prev year')}
        />
    </div>
    )
}

Component Props

export interface HeaderProps {
  month: string;
  year: number;
  isCurrentMonth: boolean;
  onNextMonth: () => void;
  onNextYear: () => void;
  onPrevMonth: () => void;
  onPrevYear: () => void;
}
PropertyTypeDescription
monthstringThe current month the calendar is displaying
yearnumberThe current year the calendar is displaying
isCurrentMonthbooleanTrue if the selected month is the same as the current month
onNextMonth() => voidCalling this functions moves to the next month
onNextYear() => voidCalling this functions moves to the same month of the next year
onPrevMonth() => voidCalling this functions moves to the previous month
onPrevYear() => voidCalling this functions moves to the same month of the previous year