Skip to content
Discussion options

You must be logged in to vote

@dzianis-l
it's because the core DayButton has internal logic required to work as expected:

  const ref = React.useRef<HTMLButtonElement>(null);
  React.useEffect(() => {
    if (modifiers.focused) ref.current?.focus();
  }, [modifiers.focused]);

You can copy and paste this logic into your custom components.
But we recommend reusing the core components in the custom components to always have the core logic up to date.
E.g.:

import { DayButton } from "react-day-picker";

function CustomDayButton(props) {
  // Simple props drilling
  return <DayButton {...props} />;
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dzianis-l
Comment options

Answer selected by rodgobbi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants