GithubHelp home page GithubHelp logo

Comments (2)

mark-tate avatar mark-tate commented on May 13, 2024

Hello PentolBakso

Your so close, with this code.
You just need to move the theme to CalendarProvider like so.
Can you try that and let me know if it gives you what you want ?

    <>
      <input className="input" {...getInputProps({ onChange: handleInputChange })} value={date} />
      <CalendarProvider
        {...getCalendarProviderProps({
          adapter: dateAdapter,
          onCalendarChange: handleCalendarChange,
          theme: calendarTheme
        })}
      >
        <Popper {...getPopperProps({ placement: 'bottom-start' })}>
          <Box>
            <Calendar />
          </Box>
        </Popper>
      </CalendarProvider>
    </>

The reason being is that we can use Calendar on it's own without defining a CalendarProvider.
For instance, you might have an inline Calendar that is not associated with any input.
When you do this, then Calendar renders it's own CalendarProvider internally, so that children of the Calendar can use the various other hooks. It also keeps the code simple for the most basic of use cases.

However, if you are using with an input, then Calendar might not be the only child in your Popper that needs to access the hooks. (If you want an example of this, then have a look at the custom panel examples)
So, CalendarProvider provides the props to Calendar and any other child that asks for them.
Rather than have props in two places, then in this instance, the Calendar gets it's props from CalendarProvider, via the useCalendarProps hook.

I'll look at updating the docs, to make this clearer.

Thanks for asking this, it made my day to see that someone is using the code.

from use-date-input.

pentolbakso avatar pentolbakso commented on May 13, 2024

Awesome..now it's working. Just as you stated above.

Keep up the good works. Give it some time.
People will start noticing your library and use it.

Thanks

from use-date-input.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.