API: primitives (@fragiola/calendar-react)
Calendar.Today
A button that runs `view.today`, going to today's range, and is disabled when the model cannot.
Calendar.Today 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.today: the range holding today (the model's clock, in the display zone). - It is disabled (
disabledanddata-disabled) whilemodel.can("view.today")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="today" on a button with type="button".
Usage
import { Calendar } from "@fragiola/calendar-react";
// inside Calendar.Root
<Calendar.Today className={(state) => (state.disabled ? "button muted" : "button")}>
Today
</Calendar.Today>Props
TodayProps; 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
TodayState is CommandButtonState (hooks):
| field | type | description |
|---|---|---|
disabled | boolean | its command cannot run now (data-disabled) |