Carbon: Pass down options to Flatpickr on the DatePicker component

Created on 26 Mar 2020  ·  4Comments  ·  Source: carbon-design-system/carbon

Summary

It would be nice to be able to pass down to Flatpickr itself some options that are you can't set on the flatpickr instance itself (ie. inline: true)

In the React DatePicker component it's a matter of adding a prop and then spreading it when initing flatpickr

Justification

We do have the need to have an inline/static picker on carbon-addons-iot for this story

As it right now, we are reparenting the calendar DOM into our component but this is far from the best option to do it.

Specific timeline issues / requests

For now we are going with the workaround but it would be nice to have soon :)

Available extra resources

I can contribute back myself but I need some support from the Carbon team given that adding a new prop to DatePicker would break semver.

Thanks!

date-picker needs more research 🕵️‍♀️ visual 🎨 enhancement 💡

Most helpful comment

It was originally intentional to not include the inline format for datepicker. I think if we wanted to include it, it would need some visual exploration because of the calendar icon. This topic needs some investigation from the design perspective before we can determine if we should do it or not.

All 4 comments

I believe the restriction on flatpickr options configuration is intentional, specifically around the inline prop

cc @carbon-design-system/design on whether or not inline date picker is a valid variant within the design system

It was originally intentional to not include the inline format for datepicker. I think if we wanted to include it, it would need some visual exploration because of the calendar icon. This topic needs some investigation from the design perspective before we can determine if we should do it or not.

hi @aagonzales! design-wise you can also ping @lukefirth and @cynthiaz who worked on https://github.com/IBM/carbon-addons-iot-react/issues/854

Along the same lines, it would be nice to be able to pass down disabled and enabled flags to flatpickr, which we're currently unable to do. Our use case is that only certain days should be selectable based on availability.

See flatpickr example documentation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahoyahoy picture ahoyahoy  ·  3Comments

mouadcherkaoui picture mouadcherkaoui  ·  3Comments

AnthumChris picture AnthumChris  ·  3Comments

JordanWSmith15 picture JordanWSmith15  ·  3Comments

ConradSchmidt picture ConradSchmidt  ·  3Comments