Skip to content

Tooltip on days in v8 #1416

Answered by gpbl
pptheberge asked this question in Support
Mar 29, 2022 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

This is an interesting use case. You can implement a wrapper for the DayContent component.

See https://react-day-picker.js.org/guides/custom-components#wrapping-the-day

For example, in this CodeSandbox: https://codesandbox.io/s/sandpack-project-forked-6omp0b?file=/App.tsx

import { DayContent, DayContentProps, DayPicker } from "react-day-picker";

import { addDays, subDays } from "date-fns";

function DayWithTooltip(props: DayContentProps) {
  return (
    <span title={`${Object.keys(props.activeModifiers)}`}>
      <DayContent {...props} />
    </span>
  );
}

export default function App() {
  const modifiers = {
    yesterday: subDays(new Date(), 1),
    today: new Date(),
    tomorrow: a…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@pptheberge
Comment options

@juliankrenz
Comment options

Answer selected by gpbl
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants