onesine / react-tailwindcss-datepicker

Modern date range picker component for React using Tailwind 3 and dayjs. Alternative to Litepie Datepicker.
https://react-tailwindcss-datepicker.vercel.app/
MIT License
529 stars 155 forks source link

range picker of months, range picker of years, year picker, format value like reactdatepicker.com & add className props for customize tailwindcss class #3

Open muh-hizbe opened 1 year ago

muh-hizbe commented 1 year ago
onesine commented 1 year ago

Thank you @muh-hizbe for the feature requests. It will be processed very soon.

pbell23 commented 1 year ago

className props would be awesome to customize design (like margins and padding for my usage)

Edit : I had not seen the package had been updated with props like inputClassName and containerClassName

I tested it, it's almost perfect but there's a little problem when adding classes already present in the base component. They might not override the base class because "the order that the classes appear in the class attribute doesn't matter, the rule that comes later in the CSS stylesheets wins". (Problem is described here : https://dev.to/diogoko/overriding-tailwind-classes-in-react-4po3).

For example, if you override py-2.5 from the base input classes with py-1.5 using inputClassName prop, py-2.5 will still be applied as py-2.5 comes after py-1.5 in the tailwind CSS stylesheet.

The solution proposed in this article is to use a utility functionality to efficiently merge tailwind classes like https://github.com/dcastil/tailwind-merge.

Example updated code with input classes : return twMerge('relative transition-all duration-300 py-2.5 pl-4 pr-14 w-full border-gray-300 dark:bg-slate-800 dark:text-white/80 dark:border-slate-600 rounded-lg tracking-wide font-light text-sm placeholder-gray-400 bg-white focus:ring disabled:opacity-40 disabled:cursor-not-allowed ${border} ${ring}', classNameOverload);

onesine commented 1 year ago

Hello @pbell23 👋

Sorry for the delay.

Thank you very much for your feedback which I really appreciate. I really like your explanation of the problem and also the package that you have just made me discover.

Thanks to you, I just learned something. I will correct the problem very soon.

PR's are always welcome.

Feel free to contribute.

danielweil commented 1 year ago

I really like the package and would be super interested in the possibility to choose month only.

onesine commented 1 year ago

Hello @danielweil 👋

Thank you for your feedback.

Please be reassured. We will do our best to answer your request as soon as possible.

awclinintell commented 1 year ago

Is this still not available? Would also like to have a monthly only option.

prime-voucher commented 10 months ago

Still not available for month and year picker?

parth1605 commented 4 months ago

Still waiting for the year picker and month picker features as it is available in every other date-picker and makes work simpler and faster.