Özel Gün Hücresi
Her gün hücresini özelleştirmek için ‘Gün’ bileşeninin oluşturma özelliğini kullanın. Bu, etkinlik göstergeleri eklemek, tarih özelliklerine dayalı özel stil oluşturmak veya gün oluşturmayı tamamen değiştirmek için kullanışlıdır.
import { useState } from "react";import { DatePicker } from "react-date-range-picker-tailwind3";
const eventDates = new Set([5, 12, 18, 25]);
function CompoundCustomDay() { const [value, setValue] = useState<Date | null>(null);
return ( <DatePicker.Root value={value} onChange={setValue} inline> <DatePicker.Content> <DatePicker.Header> <DatePicker.PrevButton /> <DatePicker.Title /> <DatePicker.NextButton /> </DatePicker.Header> <DatePicker.Grid> {({ date }) => ( <DatePicker.Day date={date}> {({ day, isDisabled, isSelected, isToday, onClick, onMouseEnter, onMouseLeave }) => ( <button type="button" onClick={onClick} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} disabled={isDisabled} style={{ display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", width: 36, height: 36, border: "none", borderRadius: 6, cursor: isDisabled ? "default" : "pointer", background: isSelected ? "#3b82f6" : "transparent", color: isSelected ? "#fff" : isToday ? "#2563eb" : undefined, fontWeight: isToday || isSelected ? 600 : 400, fontSize: 13, position: "relative", }} > {day} {eventDates.has(date.getDate()) && ( <span style={{ position: "absolute", bottom: 2, width: 4, height: 4, borderRadius: "50%", background: isSelected ? "#fff" : "#f59e0b", }} /> )} </button> )} </DatePicker.Day> )} </DatePicker.Grid> </DatePicker.Content> </DatePicker.Root> );}March 2026
Su
Mo
Tu
We
Th
Fr
Sa
Günlük Render Sahneleri
| Prop | Type | Description |
|---|---|---|
date | Date | The date object |
day | number | Day of month (1-31) |
isToday | boolean | Whether this is today |
isSelected | boolean | Whether this day is selected |
isDisabled | boolean | Whether this day is disabled |
isInRange | boolean | Whether this day is within a selected range |
isRangeStart | boolean | Whether this is the range start |
isRangeEnd | boolean | Whether this is the range end |
isInHoverRange | boolean | Whether this day is in the hover preview range |
isHoverTarget | boolean | Whether this is the hover endpoint |
isOutsideDay | boolean | Whether this day belongs to an adjacent month |
isHighlighted | boolean | Whether this day has a highlight dot |
isFocused | boolean | Whether this day has keyboard focus |
onClick | () => void | Click handler |
onMouseEnter | () => void | Mouse enter handler |
onMouseLeave | () => void | Mouse leave handler |