Skip to Content
Kenat is a work in progress project πŸ‘¨πŸ»β€πŸ’»

Month Grid UI

πŸ“… useMonthGrid()

The useMonthGrid hook generates an Ethiopian calendar grid with headers and date objects β€” ready to be rendered however you want.

βœ… Usage

import { useMonthGrid } from 'kenat-ui' const { grid, controls, state } = useMonthGrid({ useGeez: false, weekdayLang: 'amharic', weekStart: 1 // 0 for Sunday, 1 for Monday })

βœ… Returned Values

  • grid.headers: Array of weekday names (localized)

  • grid.days: Array of day objects (with holidays, date mapping, etc.)

  • controls:

    • goNext() β€” go to next month
    • goPrev() β€” go to previous month
    • rerender(overrides) β€” change options dynamically
  • state: Current year, month, and config flags

βœ… Example

<div> <h2>{grid.monthName} {grid.year}</h2> <div>{grid.headers.join(' | ')}</div> <div className="grid grid-cols-7"> {grid.days.map((day, i) => ( <div key={i}> {day?.ethiopian.day ?? ''} </div> ))} </div> </div>
Last updated on