Search code examples
keystonejsreact-day-picker

How to use an admin react component on front-end?


How can I re-use the admin react-day-picker.js component (already included in keystonejs) on a front-end form date field?


Solution

  • react-day-picker is installed as a Node module by Keystone. You can require/import it to re-use the code within that folder. You can alternatively save it as a depdency in your own project to make sure you always have it, though it isn't necessary since Keystone has it in its own package.json.

    import DayPicker from "react-day-picker";
    
    import "react-day-picker/lib/style.css"
    

    https://www.npmjs.com/package/react-day-picker