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 monthgoPrev()
β go to previous monthrerender(overrides)
β change options dynamically
-
state
: Currentyear
,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