API: primitives (@fragiola/calendar-react)
Calendar.Previous
A button that runs `view.previous`, going to the previous range, and is disabled when the model cannot.
Calendar.Previous is a button that runs one view command. Its label, icon and look are yours;
the command, its availability and the button's state are the package's.
Behaviour
- A press runs
view.previous: the previous range: a month back in a month view, a week in a week view, a day in a day view (skipping hidden days),daysdays in adaysview. - It is disabled (
disabledanddata-disabled) whilemodel.can("view.previous")says no, which happens when the step would leave thevalidRangesetting. - It is an ordinary button outside the grid's roving focus: Tab reaches it, Enter and Space press it.
It renders data-calendar-part="previous" on a button with type="button".
Usage
import { Calendar } from "@fragiola/calendar-react";
import { ChevronLeft } from "lucide-react";
// inside Calendar.Root
<Calendar.Previous aria-label="Previous month" className="icon-button">
<ChevronLeft aria-hidden />
</Calendar.Previous>An icon-only button needs its accessible name: the library sets none, so aria-label (or text)
is yours. A right-to-left calendar flips the icon in your CSS, not the command.
Props
PreviousProps; it also takes the common props and every button
attribute.
In Vue: the same props (in kebab-case in a template), and slots in place of children; see
Vue primitives.
In Angular: a directive on your element, the props as its inputs, templates in place of
children; see Angular primitives.
| prop | type | description |
|---|---|---|
children | ReactNode | its label: text or elements of yours |
State
PreviousState is CommandButtonState (hooks):
| field | type | description |
|---|---|---|
disabled | boolean | its command cannot run now (data-disabled) |