@primereact/mcp 11.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (546) hide show
  1. package/LICENSE.md +45 -0
  2. package/README.md +94 -0
  3. package/data/llms/headless/add-ons/introduction.md +16 -0
  4. package/data/llms/headless/components/accordion/api.json +252 -0
  5. package/data/llms/headless/components/accordion.md +196 -0
  6. package/data/llms/headless/components/animateonscroll/api.json +88 -0
  7. package/data/llms/headless/components/animateonscroll.md +141 -0
  8. package/data/llms/headless/components/autocomplete/api.json +787 -0
  9. package/data/llms/headless/components/autocomplete.md +249 -0
  10. package/data/llms/headless/components/avatar/api.json +154 -0
  11. package/data/llms/headless/components/avatar.md +149 -0
  12. package/data/llms/headless/components/badge/api.json +68 -0
  13. package/data/llms/headless/components/badge.md +150 -0
  14. package/data/llms/headless/components/breadcrumb/api.json +142 -0
  15. package/data/llms/headless/components/breadcrumb.md +149 -0
  16. package/data/llms/headless/components/button/api.json +62 -0
  17. package/data/llms/headless/components/button.md +73 -0
  18. package/data/llms/headless/components/card/api.json +36 -0
  19. package/data/llms/headless/components/card.md +96 -0
  20. package/data/llms/headless/components/carousel/api.json +793 -0
  21. package/data/llms/headless/components/carousel.md +196 -0
  22. package/data/llms/headless/components/checkbox/api.json +593 -0
  23. package/data/llms/headless/components/checkbox.md +184 -0
  24. package/data/llms/headless/components/chip/api.json +107 -0
  25. package/data/llms/headless/components/chip.md +141 -0
  26. package/data/llms/headless/components/collapsible/api.json +301 -0
  27. package/data/llms/headless/components/collapsible.md +136 -0
  28. package/data/llms/headless/components/compare/api.json +533 -0
  29. package/data/llms/headless/components/compare.md +142 -0
  30. package/data/llms/headless/components/contextmenu/api.json +495 -0
  31. package/data/llms/headless/components/contextmenu.md +282 -0
  32. package/data/llms/headless/components/datatable/api.json +1680 -0
  33. package/data/llms/headless/components/datatable.md +258 -0
  34. package/data/llms/headless/components/dataview/api.json +199 -0
  35. package/data/llms/headless/components/dataview.md +147 -0
  36. package/data/llms/headless/components/datepicker/api.json +2796 -0
  37. package/data/llms/headless/components/datepicker.md +456 -0
  38. package/data/llms/headless/components/dialog/api.json +626 -0
  39. package/data/llms/headless/components/dialog.md +280 -0
  40. package/data/llms/headless/components/divider/api.json +130 -0
  41. package/data/llms/headless/components/divider.md +92 -0
  42. package/data/llms/headless/components/drawer/api.json +425 -0
  43. package/data/llms/headless/components/drawer.md +220 -0
  44. package/data/llms/headless/components/fieldset/api.json +195 -0
  45. package/data/llms/headless/components/fieldset.md +154 -0
  46. package/data/llms/headless/components/fileupload/api.json +905 -0
  47. package/data/llms/headless/components/fileupload.md +323 -0
  48. package/data/llms/headless/components/floatlabel/api.json +36 -0
  49. package/data/llms/headless/components/floatlabel.md +19 -0
  50. package/data/llms/headless/components/fluid/api.json +36 -0
  51. package/data/llms/headless/components/fluid.md +19 -0
  52. package/data/llms/headless/components/focustrap/api.json +135 -0
  53. package/data/llms/headless/components/focustrap.md +125 -0
  54. package/data/llms/headless/components/gallery/api.json +1349 -0
  55. package/data/llms/headless/components/gallery.md +355 -0
  56. package/data/llms/headless/components/iconfield/api.json +62 -0
  57. package/data/llms/headless/components/iconfield.md +19 -0
  58. package/data/llms/headless/components/iftalabel/api.json +62 -0
  59. package/data/llms/headless/components/iftalabel.md +19 -0
  60. package/data/llms/headless/components/inplace/api.json +340 -0
  61. package/data/llms/headless/components/inplace.md +153 -0
  62. package/data/llms/headless/components/inputcolor/api.json +469 -0
  63. package/data/llms/headless/components/inputcolor.md +253 -0
  64. package/data/llms/headless/components/inputgroup/api.json +62 -0
  65. package/data/llms/headless/components/inputgroup.md +19 -0
  66. package/data/llms/headless/components/inputnumber/api.json +554 -0
  67. package/data/llms/headless/components/inputnumber.md +167 -0
  68. package/data/llms/headless/components/inputotp/api.json +276 -0
  69. package/data/llms/headless/components/inputotp.md +130 -0
  70. package/data/llms/headless/components/inputpassword/api.json +180 -0
  71. package/data/llms/headless/components/inputpassword.md +117 -0
  72. package/data/llms/headless/components/inputtags/api.json +497 -0
  73. package/data/llms/headless/components/inputtags.md +298 -0
  74. package/data/llms/headless/components/inputtext/api.json +81 -0
  75. package/data/llms/headless/components/inputtext.md +109 -0
  76. package/data/llms/headless/components/knob/api.json +429 -0
  77. package/data/llms/headless/components/knob.md +151 -0
  78. package/data/llms/headless/components/label/api.json +62 -0
  79. package/data/llms/headless/components/label.md +19 -0
  80. package/data/llms/headless/components/listbox/api.json +814 -0
  81. package/data/llms/headless/components/listbox.md +194 -0
  82. package/data/llms/headless/components/menu/api.json +1247 -0
  83. package/data/llms/headless/components/menu.md +283 -0
  84. package/data/llms/headless/components/message/api.json +131 -0
  85. package/data/llms/headless/components/message.md +143 -0
  86. package/data/llms/headless/components/metergroup/api.json +266 -0
  87. package/data/llms/headless/components/metergroup.md +129 -0
  88. package/data/llms/headless/components/motion/api.json +237 -0
  89. package/data/llms/headless/components/motion.md +160 -0
  90. package/data/llms/headless/components/navigationmenu/api.json +220 -0
  91. package/data/llms/headless/components/navigationmenu.md +166 -0
  92. package/data/llms/headless/components/orderlist/api.json +196 -0
  93. package/data/llms/headless/components/orderlist.md +221 -0
  94. package/data/llms/headless/components/organizationchart/api.json +372 -0
  95. package/data/llms/headless/components/organizationchart.md +254 -0
  96. package/data/llms/headless/components/paginator/api.json +311 -0
  97. package/data/llms/headless/components/paginator.md +187 -0
  98. package/data/llms/headless/components/panel/api.json +195 -0
  99. package/data/llms/headless/components/panel.md +150 -0
  100. package/data/llms/headless/components/picklist/api.json +293 -0
  101. package/data/llms/headless/components/picklist.md +270 -0
  102. package/data/llms/headless/components/popover/api.json +405 -0
  103. package/data/llms/headless/components/popover.md +301 -0
  104. package/data/llms/headless/components/portal/api.json +56 -0
  105. package/data/llms/headless/components/portal.md +102 -0
  106. package/data/llms/headless/components/positioner/api.json +165 -0
  107. package/data/llms/headless/components/positioner.md +181 -0
  108. package/data/llms/headless/components/progressbar/api.json +87 -0
  109. package/data/llms/headless/components/progressbar.md +122 -0
  110. package/data/llms/headless/components/progressspinner/api.json +337 -0
  111. package/data/llms/headless/components/progressspinner.md +128 -0
  112. package/data/llms/headless/components/radiobutton/api.json +569 -0
  113. package/data/llms/headless/components/radiobutton.md +195 -0
  114. package/data/llms/headless/components/rating/api.json +347 -0
  115. package/data/llms/headless/components/rating.md +181 -0
  116. package/data/llms/headless/components/scrollarea/api.json +730 -0
  117. package/data/llms/headless/components/scrollarea.md +232 -0
  118. package/data/llms/headless/components/select/api.json +829 -0
  119. package/data/llms/headless/components/select.md +262 -0
  120. package/data/llms/headless/components/sidebar/api.json +433 -0
  121. package/data/llms/headless/components/sidebar.md +266 -0
  122. package/data/llms/headless/components/skeleton/api.json +68 -0
  123. package/data/llms/headless/components/skeleton.md +95 -0
  124. package/data/llms/headless/components/slider/api.json +559 -0
  125. package/data/llms/headless/components/slider.md +158 -0
  126. package/data/llms/headless/components/speeddial/api.json +459 -0
  127. package/data/llms/headless/components/speeddial.md +181 -0
  128. package/data/llms/headless/components/splitter/api.json +582 -0
  129. package/data/llms/headless/components/splitter.md +159 -0
  130. package/data/llms/headless/components/stepper/api.json +385 -0
  131. package/data/llms/headless/components/stepper.md +183 -0
  132. package/data/llms/headless/components/styleclass/api.json +134 -0
  133. package/data/llms/headless/components/styleclass.md +129 -0
  134. package/data/llms/headless/components/tabs/api.json +336 -0
  135. package/data/llms/headless/components/tabs.md +158 -0
  136. package/data/llms/headless/components/tag/api.json +62 -0
  137. package/data/llms/headless/components/tag.md +121 -0
  138. package/data/llms/headless/components/terminal/api.json +117 -0
  139. package/data/llms/headless/components/terminal.md +183 -0
  140. package/data/llms/headless/components/textarea/api.json +81 -0
  141. package/data/llms/headless/components/textarea.md +110 -0
  142. package/data/llms/headless/components/timeline/api.json +270 -0
  143. package/data/llms/headless/components/timeline.md +117 -0
  144. package/data/llms/headless/components/toast/api.json +455 -0
  145. package/data/llms/headless/components/toast.md +277 -0
  146. package/data/llms/headless/components/togglebutton/api.json +357 -0
  147. package/data/llms/headless/components/togglebutton.md +183 -0
  148. package/data/llms/headless/components/toggleswitch/api.json +326 -0
  149. package/data/llms/headless/components/toggleswitch.md +164 -0
  150. package/data/llms/headless/components/toolbar/api.json +68 -0
  151. package/data/llms/headless/components/toolbar.md +96 -0
  152. package/data/llms/headless/components/tooltip/api.json +478 -0
  153. package/data/llms/headless/components/tooltip.md +233 -0
  154. package/data/llms/headless/components/tree/api.json +1297 -0
  155. package/data/llms/headless/components/tree.md +297 -0
  156. package/data/llms/headless/components/treetable/api.json +1680 -0
  157. package/data/llms/headless/components/treetable.md +177 -0
  158. package/data/llms/headless/guides/ai/llms.md +25 -0
  159. package/data/llms/headless/guides/installation.md +126 -0
  160. package/data/llms/headless/guides/introduction.md +20 -0
  161. package/data/llms/headless/guides/misc/accessibility.md +228 -0
  162. package/data/llms/headless/llms.md +25 -0
  163. package/data/llms/headless/resources/introduction.md +15 -0
  164. package/data/llms/hooks/gettingstarted/introduction.md +34 -0
  165. package/data/llms/hooks/gettingstarted/setup.md +54 -0
  166. package/data/llms/hooks/use-attr-selector.md +25 -0
  167. package/data/llms/hooks/use-controlled-state.md +31 -0
  168. package/data/llms/hooks/use-event-listener.md +37 -0
  169. package/data/llms/hooks/use-filter.md +312 -0
  170. package/data/llms/hooks/use-hot-key.md +40 -0
  171. package/data/llms/hooks/use-id.md +24 -0
  172. package/data/llms/hooks/use-intersection-observer.md +42 -0
  173. package/data/llms/hooks/use-is-mobile.md +24 -0
  174. package/data/llms/hooks/use-key-filter.md +139 -0
  175. package/data/llms/hooks/use-local-storage.md +28 -0
  176. package/data/llms/hooks/use-mask.md +53 -0
  177. package/data/llms/hooks/use-match-media.md +28 -0
  178. package/data/llms/hooks/use-mount-effect.md +25 -0
  179. package/data/llms/hooks/use-mounted.md +36 -0
  180. package/data/llms/hooks/use-number-formatter.md +48 -0
  181. package/data/llms/hooks/use-presence.md +44 -0
  182. package/data/llms/hooks/use-previous.md +28 -0
  183. package/data/llms/hooks/use-props.md +37 -0
  184. package/data/llms/hooks/use-queue-task.md +29 -0
  185. package/data/llms/hooks/use-scrolltop.md +87 -0
  186. package/data/llms/hooks/use-sortable-list.md +226 -0
  187. package/data/llms/hooks/use-tree-filter.md +216 -0
  188. package/data/llms/hooks/use-unmount-effect.md +23 -0
  189. package/data/llms/hooks/use-update-effect.md +27 -0
  190. package/data/llms/hooks/use-view-transition.md +31 -0
  191. package/data/llms/hooks/use-visibility-change.md +30 -0
  192. package/data/llms/llms-full.txt +125291 -0
  193. package/data/llms/llms.txt +379 -0
  194. package/data/llms/manifest.json +12409 -0
  195. package/data/llms/mcp-data.json +14481 -0
  196. package/data/llms/primitive/add-ons/introduction.md +16 -0
  197. package/data/llms/primitive/components/accordion/api.json +1411 -0
  198. package/data/llms/primitive/components/accordion.md +231 -0
  199. package/data/llms/primitive/components/animateonscroll/api.json +193 -0
  200. package/data/llms/primitive/components/animateonscroll.md +91 -0
  201. package/data/llms/primitive/components/autocomplete/api.json +3167 -0
  202. package/data/llms/primitive/components/autocomplete.md +344 -0
  203. package/data/llms/primitive/components/avatar/api.json +703 -0
  204. package/data/llms/primitive/components/avatar.md +134 -0
  205. package/data/llms/primitive/components/badge/api.json +363 -0
  206. package/data/llms/primitive/components/badge.md +118 -0
  207. package/data/llms/primitive/components/breadcrumb/api.json +1162 -0
  208. package/data/llms/primitive/components/breadcrumb.md +196 -0
  209. package/data/llms/primitive/components/button/api.json +246 -0
  210. package/data/llms/primitive/components/button.md +114 -0
  211. package/data/llms/primitive/components/buttongroup/api.json +168 -0
  212. package/data/llms/primitive/components/buttongroup.md +43 -0
  213. package/data/llms/primitive/components/card/api.json +1252 -0
  214. package/data/llms/primitive/components/card.md +159 -0
  215. package/data/llms/primitive/components/carousel/api.json +1374 -0
  216. package/data/llms/primitive/components/carousel.md +220 -0
  217. package/data/llms/primitive/components/checkbox/api.json +697 -0
  218. package/data/llms/primitive/components/checkbox.md +160 -0
  219. package/data/llms/primitive/components/checkboxgroup/api.json +252 -0
  220. package/data/llms/primitive/components/checkboxgroup.md +58 -0
  221. package/data/llms/primitive/components/chip/api.json +853 -0
  222. package/data/llms/primitive/components/chip.md +135 -0
  223. package/data/llms/primitive/components/collapsible/api.json +581 -0
  224. package/data/llms/primitive/components/collapsible.md +133 -0
  225. package/data/llms/primitive/components/compare/api.json +909 -0
  226. package/data/llms/primitive/components/compare.md +156 -0
  227. package/data/llms/primitive/components/contextmenu/api.json +3454 -0
  228. package/data/llms/primitive/components/contextmenu.md +483 -0
  229. package/data/llms/primitive/components/datatable/api.json +7832 -0
  230. package/data/llms/primitive/components/datatable.md +561 -0
  231. package/data/llms/primitive/components/dataview/api.json +819 -0
  232. package/data/llms/primitive/components/dataview.md +163 -0
  233. package/data/llms/primitive/components/datepicker/api.json +9055 -0
  234. package/data/llms/primitive/components/datepicker.md +760 -0
  235. package/data/llms/primitive/components/dialog/api.json +2491 -0
  236. package/data/llms/primitive/components/dialog.md +276 -0
  237. package/data/llms/primitive/components/divider/api.json +214 -0
  238. package/data/llms/primitive/components/divider.md +96 -0
  239. package/data/llms/primitive/components/drawer/api.json +1879 -0
  240. package/data/llms/primitive/components/drawer.md +220 -0
  241. package/data/llms/primitive/components/fieldset/api.json +1116 -0
  242. package/data/llms/primitive/components/fieldset.md +183 -0
  243. package/data/llms/primitive/components/fileupload/api.json +2445 -0
  244. package/data/llms/primitive/components/fileupload.md +282 -0
  245. package/data/llms/primitive/components/floatlabel/api.json +176 -0
  246. package/data/llms/primitive/components/floatlabel.md +47 -0
  247. package/data/llms/primitive/components/focustrap/api.json +241 -0
  248. package/data/llms/primitive/components/focustrap.md +93 -0
  249. package/data/llms/primitive/components/gallery/api.json +3622 -0
  250. package/data/llms/primitive/components/gallery.md +387 -0
  251. package/data/llms/primitive/components/iconfield/api.json +322 -0
  252. package/data/llms/primitive/components/iconfield.md +53 -0
  253. package/data/llms/primitive/components/iftalabel/api.json +177 -0
  254. package/data/llms/primitive/components/iftalabel.md +47 -0
  255. package/data/llms/primitive/components/inplace/api.json +783 -0
  256. package/data/llms/primitive/components/inplace.md +141 -0
  257. package/data/llms/primitive/components/inputcolor/api.json +2211 -0
  258. package/data/llms/primitive/components/inputcolor.md +295 -0
  259. package/data/llms/primitive/components/inputnumber/api.json +469 -0
  260. package/data/llms/primitive/components/inputnumber.md +99 -0
  261. package/data/llms/primitive/components/inputotp/api.json +469 -0
  262. package/data/llms/primitive/components/inputotp.md +121 -0
  263. package/data/llms/primitive/components/inputpassword/api.json +278 -0
  264. package/data/llms/primitive/components/inputpassword.md +84 -0
  265. package/data/llms/primitive/components/inputtags/api.json +407 -0
  266. package/data/llms/primitive/components/inputtags.md +243 -0
  267. package/data/llms/primitive/components/inputtext/api.json +207 -0
  268. package/data/llms/primitive/components/inputtext.md +81 -0
  269. package/data/llms/primitive/components/knob/api.json +841 -0
  270. package/data/llms/primitive/components/knob.md +148 -0
  271. package/data/llms/primitive/components/label/api.json +177 -0
  272. package/data/llms/primitive/components/label.md +44 -0
  273. package/data/llms/primitive/components/listbox/api.json +1741 -0
  274. package/data/llms/primitive/components/listbox.md +206 -0
  275. package/data/llms/primitive/components/menu/api.json +3836 -0
  276. package/data/llms/primitive/components/menu.md +479 -0
  277. package/data/llms/primitive/components/message/api.json +863 -0
  278. package/data/llms/primitive/components/message.md +151 -0
  279. package/data/llms/primitive/components/metergroup/api.json +1222 -0
  280. package/data/llms/primitive/components/metergroup.md +209 -0
  281. package/data/llms/primitive/components/motion.md +112 -0
  282. package/data/llms/primitive/components/navigationmenu/api.json +298 -0
  283. package/data/llms/primitive/components/navigationmenu.md +184 -0
  284. package/data/llms/primitive/components/organizationchart.md +133 -0
  285. package/data/llms/primitive/components/paginator/api.json +1637 -0
  286. package/data/llms/primitive/components/paginator.md +223 -0
  287. package/data/llms/primitive/components/panel/api.json +1270 -0
  288. package/data/llms/primitive/components/panel.md +186 -0
  289. package/data/llms/primitive/components/popover/api.json +2281 -0
  290. package/data/llms/primitive/components/popover.md +277 -0
  291. package/data/llms/primitive/components/portal/api.json +176 -0
  292. package/data/llms/primitive/components/portal.md +79 -0
  293. package/data/llms/primitive/components/progressbar/api.json +857 -0
  294. package/data/llms/primitive/components/progressbar.md +153 -0
  295. package/data/llms/primitive/components/progressspinner/api.json +725 -0
  296. package/data/llms/primitive/components/progressspinner.md +133 -0
  297. package/data/llms/primitive/components/radiobutton/api.json +929 -0
  298. package/data/llms/primitive/components/radiobutton.md +201 -0
  299. package/data/llms/primitive/components/rating/api.json +878 -0
  300. package/data/llms/primitive/components/rating.md +160 -0
  301. package/data/llms/primitive/components/scrollarea/api.json +1187 -0
  302. package/data/llms/primitive/components/scrollarea.md +255 -0
  303. package/data/llms/primitive/components/select/api.json +3167 -0
  304. package/data/llms/primitive/components/select.md +351 -0
  305. package/data/llms/primitive/components/sidebar/api.json +3699 -0
  306. package/data/llms/primitive/components/sidebar.md +444 -0
  307. package/data/llms/primitive/components/skeleton/api.json +213 -0
  308. package/data/llms/primitive/components/skeleton.md +80 -0
  309. package/data/llms/primitive/components/slider/api.json +1066 -0
  310. package/data/llms/primitive/components/slider.md +161 -0
  311. package/data/llms/primitive/components/speeddial/api.json +1002 -0
  312. package/data/llms/primitive/components/speeddial.md +197 -0
  313. package/data/llms/primitive/components/splitter/api.json +901 -0
  314. package/data/llms/primitive/components/splitter.md +137 -0
  315. package/data/llms/primitive/components/stepper/api.json +2102 -0
  316. package/data/llms/primitive/components/stepper.md +253 -0
  317. package/data/llms/primitive/components/styleclass.md +399 -0
  318. package/data/llms/primitive/components/tabs/api.json +1705 -0
  319. package/data/llms/primitive/components/tabs.md +200 -0
  320. package/data/llms/primitive/components/tag/api.json +189 -0
  321. package/data/llms/primitive/components/tag.md +100 -0
  322. package/data/llms/primitive/components/terminal/api.json +1709 -0
  323. package/data/llms/primitive/components/terminal.md +227 -0
  324. package/data/llms/primitive/components/textarea/api.json +213 -0
  325. package/data/llms/primitive/components/textarea.md +83 -0
  326. package/data/llms/primitive/components/timeline/api.json +1180 -0
  327. package/data/llms/primitive/components/timeline.md +185 -0
  328. package/data/llms/primitive/components/toast/api.json +2102 -0
  329. package/data/llms/primitive/components/toast.md +291 -0
  330. package/data/llms/primitive/components/togglebutton/api.json +433 -0
  331. package/data/llms/primitive/components/togglebutton.md +161 -0
  332. package/data/llms/primitive/components/togglebuttongroup/api.json +276 -0
  333. package/data/llms/primitive/components/togglebuttongroup.md +61 -0
  334. package/data/llms/primitive/components/toggleswitch/api.json +681 -0
  335. package/data/llms/primitive/components/toggleswitch.md +149 -0
  336. package/data/llms/primitive/components/toolbar/api.json +646 -0
  337. package/data/llms/primitive/components/toolbar.md +126 -0
  338. package/data/llms/primitive/components/tooltip/api.json +1534 -0
  339. package/data/llms/primitive/components/tooltip.md +202 -0
  340. package/data/llms/primitive/components/tree/api.json +2952 -0
  341. package/data/llms/primitive/components/tree.md +292 -0
  342. package/data/llms/primitive/components/treetable.md +187 -0
  343. package/data/llms/primitive/components/visuallyhidden/api.json +186 -0
  344. package/data/llms/primitive/components/visuallyhidden.md +87 -0
  345. package/data/llms/primitive/guides/ai/llms.md +25 -0
  346. package/data/llms/primitive/guides/icons/customicons.md +47 -0
  347. package/data/llms/primitive/guides/icons/primeicons.md +112 -0
  348. package/data/llms/primitive/guides/installation.md +115 -0
  349. package/data/llms/primitive/guides/introduction.md +20 -0
  350. package/data/llms/primitive/guides/misc/accessibility.md +215 -0
  351. package/data/llms/primitive/guides/misc/passthrough.md +95 -0
  352. package/data/llms/primitive/guides/misc/rtl.md +27 -0
  353. package/data/llms/primitive/llms.md +25 -0
  354. package/data/llms/primitive/resources/introduction.md +15 -0
  355. package/data/llms/styled/add-ons/introduction.md +16 -0
  356. package/data/llms/styled/components/accordion.md +735 -0
  357. package/data/llms/styled/components/animateonscroll.md +264 -0
  358. package/data/llms/styled/components/autocomplete.md +1597 -0
  359. package/data/llms/styled/components/avatar.md +313 -0
  360. package/data/llms/styled/components/badge.md +213 -0
  361. package/data/llms/styled/components/breadcrumb.md +461 -0
  362. package/data/llms/styled/components/button/api.json +246 -0
  363. package/data/llms/styled/components/button.md +641 -0
  364. package/data/llms/styled/components/buttongroup.md +614 -0
  365. package/data/llms/styled/components/card.md +228 -0
  366. package/data/llms/styled/components/carousel.md +388 -0
  367. package/data/llms/styled/components/checkbox.md +329 -0
  368. package/data/llms/styled/components/checkboxgroup.md +619 -0
  369. package/data/llms/styled/components/chip.md +300 -0
  370. package/data/llms/styled/components/compare.md +271 -0
  371. package/data/llms/styled/components/contextmenu.md +550 -0
  372. package/data/llms/styled/components/datatable.md +8259 -0
  373. package/data/llms/styled/components/dataview.md +907 -0
  374. package/data/llms/styled/components/datepicker.md +2807 -0
  375. package/data/llms/styled/components/dialog.md +1047 -0
  376. package/data/llms/styled/components/divider.md +207 -0
  377. package/data/llms/styled/components/drawer.md +470 -0
  378. package/data/llms/styled/components/fieldset.md +334 -0
  379. package/data/llms/styled/components/fileupload.md +747 -0
  380. package/data/llms/styled/components/floatlabel/api.json +210 -0
  381. package/data/llms/styled/components/floatlabel.md +231 -0
  382. package/data/llms/styled/components/fluid/api.json +204 -0
  383. package/data/llms/styled/components/fluid.md +177 -0
  384. package/data/llms/styled/components/focustrap.md +203 -0
  385. package/data/llms/styled/components/gallery.md +553 -0
  386. package/data/llms/styled/components/iconfield/api.json +382 -0
  387. package/data/llms/styled/components/iconfield.md +385 -0
  388. package/data/llms/styled/components/iftalabel/api.json +237 -0
  389. package/data/llms/styled/components/iftalabel.md +158 -0
  390. package/data/llms/styled/components/inplace.md +312 -0
  391. package/data/llms/styled/components/inputcolor.md +674 -0
  392. package/data/llms/styled/components/inputgroup/api.json +399 -0
  393. package/data/llms/styled/components/inputgroup.md +604 -0
  394. package/data/llms/styled/components/inputmask.md +282 -0
  395. package/data/llms/styled/components/inputnumber.md +563 -0
  396. package/data/llms/styled/components/inputotp.md +335 -0
  397. package/data/llms/styled/components/inputpassword.md +630 -0
  398. package/data/llms/styled/components/inputtags.md +727 -0
  399. package/data/llms/styled/components/inputtext.md +190 -0
  400. package/data/llms/styled/components/keyfilter.md +289 -0
  401. package/data/llms/styled/components/knob.md +305 -0
  402. package/data/llms/styled/components/label/api.json +237 -0
  403. package/data/llms/styled/components/label.md +224 -0
  404. package/data/llms/styled/components/listbox.md +807 -0
  405. package/data/llms/styled/components/menu.md +1175 -0
  406. package/data/llms/styled/components/message.md +570 -0
  407. package/data/llms/styled/components/metergroup.md +449 -0
  408. package/data/llms/styled/components/navigationmenu.md +926 -0
  409. package/data/llms/styled/components/orderlist.md +519 -0
  410. package/data/llms/styled/components/organizationchart/api.json +1457 -0
  411. package/data/llms/styled/components/organizationchart.md +791 -0
  412. package/data/llms/styled/components/overlaymanager.md +519 -0
  413. package/data/llms/styled/components/paginator.md +506 -0
  414. package/data/llms/styled/components/panel.md +394 -0
  415. package/data/llms/styled/components/picklist.md +1004 -0
  416. package/data/llms/styled/components/popover.md +372 -0
  417. package/data/llms/styled/components/progressbar.md +438 -0
  418. package/data/llms/styled/components/progressspinner.md +128 -0
  419. package/data/llms/styled/components/radiobutton.md +488 -0
  420. package/data/llms/styled/components/rating/api.json +766 -0
  421. package/data/llms/styled/components/rating.md +518 -0
  422. package/data/llms/styled/components/scrollarea.md +627 -0
  423. package/data/llms/styled/components/select.md +2122 -0
  424. package/data/llms/styled/components/sidebar.md +1587 -0
  425. package/data/llms/styled/components/skeleton.md +226 -0
  426. package/data/llms/styled/components/slider.md +453 -0
  427. package/data/llms/styled/components/speeddial.md +723 -0
  428. package/data/llms/styled/components/splitter.md +536 -0
  429. package/data/llms/styled/components/stepper.md +614 -0
  430. package/data/llms/styled/components/tabs.md +543 -0
  431. package/data/llms/styled/components/tag.md +263 -0
  432. package/data/llms/styled/components/terminal.md +543 -0
  433. package/data/llms/styled/components/textarea.md +257 -0
  434. package/data/llms/styled/components/timeline.md +620 -0
  435. package/data/llms/styled/components/toast.md +1013 -0
  436. package/data/llms/styled/components/togglebutton.md +287 -0
  437. package/data/llms/styled/components/togglebuttongroup.md +328 -0
  438. package/data/llms/styled/components/toggleswitch.md +262 -0
  439. package/data/llms/styled/components/toolbar.md +187 -0
  440. package/data/llms/styled/components/tooltip.md +430 -0
  441. package/data/llms/styled/components/tree.md +1386 -0
  442. package/data/llms/styled/components/treetable.md +6842 -0
  443. package/data/llms/styled/guides/ai/llms.md +25 -0
  444. package/data/llms/styled/guides/configuration.md +151 -0
  445. package/data/llms/styled/guides/icons/customicons.md +47 -0
  446. package/data/llms/styled/guides/icons/primeicons.md +112 -0
  447. package/data/llms/styled/guides/installation/astro.md +97 -0
  448. package/data/llms/styled/guides/installation/manual.md +3 -0
  449. package/data/llms/styled/guides/installation/nextjs.md +129 -0
  450. package/data/llms/styled/guides/installation/react-router.md +88 -0
  451. package/data/llms/styled/guides/installation/tanstack.md +92 -0
  452. package/data/llms/styled/guides/installation/vite.md +91 -0
  453. package/data/llms/styled/guides/installation.md +42 -0
  454. package/data/llms/styled/guides/introduction.md +20 -0
  455. package/data/llms/styled/guides/misc/accessibility.md +211 -0
  456. package/data/llms/styled/guides/misc/animations.md +389 -0
  457. package/data/llms/styled/guides/misc/passthrough.md +95 -0
  458. package/data/llms/styled/guides/misc/rtl.md +27 -0
  459. package/data/llms/styled/guides/theming/styled.md +779 -0
  460. package/data/llms/styled/guides/theming/tailwind.md +473 -0
  461. package/data/llms/styled/guides/theming/unstyled.md +115 -0
  462. package/data/llms/styled/resources/introduction.md +15 -0
  463. package/data/llms/tailwind/add-ons/introduction.md +16 -0
  464. package/data/llms/tailwind/components/accordion.md +383 -0
  465. package/data/llms/tailwind/components/autocomplete.md +1346 -0
  466. package/data/llms/tailwind/components/avatar.md +305 -0
  467. package/data/llms/tailwind/components/badge.md +207 -0
  468. package/data/llms/tailwind/components/breadcrumb.md +387 -0
  469. package/data/llms/tailwind/components/button/api.json +246 -0
  470. package/data/llms/tailwind/components/button.md +617 -0
  471. package/data/llms/tailwind/components/buttongroup.md +599 -0
  472. package/data/llms/tailwind/components/card.md +224 -0
  473. package/data/llms/tailwind/components/carousel.md +329 -0
  474. package/data/llms/tailwind/components/checkbox.md +179 -0
  475. package/data/llms/tailwind/components/checkboxgroup.md +279 -0
  476. package/data/llms/tailwind/components/chip.md +304 -0
  477. package/data/llms/tailwind/components/compare.md +295 -0
  478. package/data/llms/tailwind/components/contextmenu.md +415 -0
  479. package/data/llms/tailwind/components/datatable.md +4062 -0
  480. package/data/llms/tailwind/components/dataview.md +864 -0
  481. package/data/llms/tailwind/components/datepicker.md +823 -0
  482. package/data/llms/tailwind/components/dialog.md +1216 -0
  483. package/data/llms/tailwind/components/divider.md +205 -0
  484. package/data/llms/tailwind/components/drawer.md +500 -0
  485. package/data/llms/tailwind/components/fieldset.md +326 -0
  486. package/data/llms/tailwind/components/fluid.md +117 -0
  487. package/data/llms/tailwind/components/iconfield.md +197 -0
  488. package/data/llms/tailwind/components/inplace.md +324 -0
  489. package/data/llms/tailwind/components/inputcolor.md +493 -0
  490. package/data/llms/tailwind/components/inputgroup.md +375 -0
  491. package/data/llms/tailwind/components/inputnumber.md +463 -0
  492. package/data/llms/tailwind/components/inputotp.md +255 -0
  493. package/data/llms/tailwind/components/inputpassword.md +543 -0
  494. package/data/llms/tailwind/components/inputtext.md +141 -0
  495. package/data/llms/tailwind/components/label.md +100 -0
  496. package/data/llms/tailwind/components/listbox.md +886 -0
  497. package/data/llms/tailwind/components/menu.md +1049 -0
  498. package/data/llms/tailwind/components/message.md +575 -0
  499. package/data/llms/tailwind/components/metergroup.md +510 -0
  500. package/data/llms/tailwind/components/navigationmenu.md +528 -0
  501. package/data/llms/tailwind/components/overlaymanager.md +567 -0
  502. package/data/llms/tailwind/components/paginator.md +306 -0
  503. package/data/llms/tailwind/components/panel.md +395 -0
  504. package/data/llms/tailwind/components/popover.md +424 -0
  505. package/data/llms/tailwind/components/progressbar.md +313 -0
  506. package/data/llms/tailwind/components/radiobutton.md +366 -0
  507. package/data/llms/tailwind/components/rating.md +300 -0
  508. package/data/llms/tailwind/components/scrollarea.md +638 -0
  509. package/data/llms/tailwind/components/select.md +1220 -0
  510. package/data/llms/tailwind/components/sidebar.md +1511 -0
  511. package/data/llms/tailwind/components/skeleton.md +236 -0
  512. package/data/llms/tailwind/components/slider.md +291 -0
  513. package/data/llms/tailwind/components/splitter.md +546 -0
  514. package/data/llms/tailwind/components/tabs.md +462 -0
  515. package/data/llms/tailwind/components/tag.md +255 -0
  516. package/data/llms/tailwind/components/textarea.md +170 -0
  517. package/data/llms/tailwind/components/timeline.md +656 -0
  518. package/data/llms/tailwind/components/toast.md +246 -0
  519. package/data/llms/tailwind/components/togglebutton.md +264 -0
  520. package/data/llms/tailwind/components/togglebuttongroup.md +262 -0
  521. package/data/llms/tailwind/components/toggleswitch.md +203 -0
  522. package/data/llms/tailwind/components/toolbar.md +192 -0
  523. package/data/llms/tailwind/components/tooltip.md +449 -0
  524. package/data/llms/tailwind/guides/ai/llms.md +25 -0
  525. package/data/llms/tailwind/guides/icons/customicons.md +47 -0
  526. package/data/llms/tailwind/guides/icons/primeicons.md +112 -0
  527. package/data/llms/tailwind/guides/installation/astro.md +165 -0
  528. package/data/llms/tailwind/guides/installation/manual.md +3 -0
  529. package/data/llms/tailwind/guides/installation/nextjs.md +169 -0
  530. package/data/llms/tailwind/guides/installation/react-router.md +157 -0
  531. package/data/llms/tailwind/guides/installation/tanstack.md +161 -0
  532. package/data/llms/tailwind/guides/installation/vite.md +160 -0
  533. package/data/llms/tailwind/guides/installation.md +42 -0
  534. package/data/llms/tailwind/guides/introduction.md +20 -0
  535. package/data/llms/tailwind/guides/misc/accessibility.md +205 -0
  536. package/data/llms/tailwind/guides/misc/passthrough.md +95 -0
  537. package/data/llms/tailwind/guides/misc/rtl.md +27 -0
  538. package/data/llms/tailwind/guides/theming/guide.md +179 -0
  539. package/data/llms/tailwind/guides/theming.md +191 -0
  540. package/data/llms/tailwind/llms.md +25 -0
  541. package/data/llms/tailwind/resources/introduction.md +15 -0
  542. package/data/manifest.json +12409 -0
  543. package/data/mcp-data.json +14481 -0
  544. package/dist/index.d.ts +9 -0
  545. package/dist/index.js +2 -0
  546. package/package.json +61 -0
@@ -0,0 +1,2807 @@
1
+ # DatePicker
2
+
3
+ DatePicker is a form component to work with dates.
4
+
5
+ ```tsx
6
+ 'use client';
7
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
8
+ import { ChevronRight } from '@primeicons/react/chevron-right';
9
+ import { Button } from '@primereact/ui/button';
10
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
11
+ import { InputText } from '@primereact/ui/inputtext';
12
+ import { Label } from '@primereact/ui/label';
13
+ import * as React from 'react';
14
+
15
+ const MS_PER_DAY = 1000 * 60 * 60 * 24;
16
+
17
+ export default function Preview() {
18
+ const [date, setDate] = React.useState<DatePickerRootProps['value']>(null);
19
+ const [start, end] = Array.isArray(date) ? date : [null, null];
20
+ const nights = start instanceof Date && end instanceof Date ? Math.round((end.getTime() - start.getTime()) / MS_PER_DAY) : null;
21
+
22
+ return (
23
+ <div className="flex flex-col gap-1.5 max-w-2xs mx-auto">
24
+ <Label htmlFor="trip-dates" className="font-semibold">
25
+ When are you traveling?
26
+ </Label>
27
+ <DatePicker.Root
28
+ value={date}
29
+ selectionMode="range"
30
+ manualInput={false}
31
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}
32
+ >
33
+ <DatePicker.Input as={InputText} id="trip-dates" placeholder="Select departure and return" fluid />
34
+ <DatePicker.Portal>
35
+ <DatePicker.Positioner align="start">
36
+ <DatePicker.Popup>
37
+ <DatePicker.Body>
38
+ <DatePicker.Panel>
39
+ <DatePicker.Calendar>
40
+ <DatePicker.Header>
41
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
42
+ <ChevronLeft />
43
+ </DatePicker.Prev>
44
+ <DatePicker.Title>
45
+ <DatePicker.SelectMonth />
46
+ <DatePicker.SelectYear />
47
+ <DatePicker.Decade />
48
+ </DatePicker.Title>
49
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
50
+ <ChevronRight />
51
+ </DatePicker.Next>
52
+ </DatePicker.Header>
53
+ <DatePicker.Table>
54
+ <DatePicker.TableHead />
55
+ <DatePicker.TableBody />
56
+ <DatePicker.TableBody view="month" />
57
+ <DatePicker.TableBody view="year" />
58
+ </DatePicker.Table>
59
+ </DatePicker.Calendar>
60
+ </DatePicker.Panel>
61
+ </DatePicker.Body>
62
+ </DatePicker.Popup>
63
+ </DatePicker.Positioner>
64
+ </DatePicker.Portal>
65
+ </DatePicker.Root>
66
+ <small className="text-muted-color">
67
+ {nights
68
+ ? `${nights} ${nights === 1 ? 'night' : 'nights'} · Free cancellation up to 24h before check-in`
69
+ : 'Pick your departure and return dates · Free cancellation'}
70
+ </small>
71
+ </div>
72
+ );
73
+ }
74
+ ```
75
+
76
+ ## Usage
77
+
78
+ ```tsx
79
+ import { DatePicker } from '@primereact/ui/datepicker';
80
+ ```
81
+
82
+ ```tsx
83
+ <DatePicker.Root>
84
+ <DatePicker.Input />
85
+ <DatePicker.Clear />
86
+ <DatePicker.Trigger>
87
+ <DatePicker.Value />
88
+ <DatePicker.Indicator />
89
+ </DatePicker.Trigger>
90
+ <DatePicker.Portal>
91
+ <DatePicker.Positioner>
92
+ <DatePicker.Popup>
93
+ <DatePicker.Calendar>
94
+ <DatePicker.Header>
95
+ <DatePicker.Prev />
96
+ <DatePicker.Title>
97
+ <DatePicker.SelectMonth />
98
+ <DatePicker.SelectYear />
99
+ <DatePicker.Decade />
100
+ </DatePicker.Title>
101
+ <DatePicker.Next />
102
+ </DatePicker.Header>
103
+ <DatePicker.Table>
104
+ <DatePicker.TableHead />
105
+ <DatePicker.TableBody />
106
+ <DatePicker.TableBody view="month" />
107
+ <DatePicker.TableBody view="year" />
108
+ </DatePicker.Table>
109
+ <DatePicker.Buttonbar />
110
+ </DatePicker.Calendar>
111
+ <DatePicker.Time />
112
+ </DatePicker.Popup>
113
+ </DatePicker.Positioner>
114
+ </DatePicker.Portal>
115
+ </DatePicker.Root>
116
+ ```
117
+
118
+ ## Examples
119
+
120
+ ### Basic
121
+
122
+ Select a single date from an interactive calendar popup.
123
+
124
+ ```tsx
125
+ 'use client';
126
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
127
+ import { ChevronRight } from '@primeicons/react/chevron-right';
128
+ import { Button } from '@primereact/ui/button';
129
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
130
+ import { InputText } from '@primereact/ui/inputtext';
131
+ import * as React from 'react';
132
+
133
+ export default function BasicDemo() {
134
+ const [date, setDate] = React.useState<DatePickerRootProps['value']>(null);
135
+
136
+ return (
137
+ <div className="flex justify-center">
138
+ <DatePicker.Root value={date} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
139
+ <DatePicker.Input as={InputText} />
140
+ <DatePicker.Portal>
141
+ <DatePicker.Positioner align="start">
142
+ <DatePicker.Popup>
143
+ <DatePicker.Body>
144
+ <DatePicker.Panel>
145
+ <DatePicker.Calendar>
146
+ <DatePicker.Header>
147
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
148
+ <ChevronLeft />
149
+ </DatePicker.Prev>
150
+ <DatePicker.Title>
151
+ <DatePicker.SelectMonth />
152
+ <DatePicker.SelectYear />
153
+ <DatePicker.Decade />
154
+ </DatePicker.Title>
155
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
156
+ <ChevronRight />
157
+ </DatePicker.Next>
158
+ </DatePicker.Header>
159
+ <DatePicker.Table>
160
+ <DatePicker.TableHead />
161
+ <DatePicker.TableBody />
162
+ <DatePicker.TableBody view="month" />
163
+ <DatePicker.TableBody view="year" />
164
+ </DatePicker.Table>
165
+ </DatePicker.Calendar>
166
+ </DatePicker.Panel>
167
+ </DatePicker.Body>
168
+ </DatePicker.Popup>
169
+ </DatePicker.Positioner>
170
+ </DatePicker.Portal>
171
+ </DatePicker.Root>
172
+ </div>
173
+ );
174
+ }
175
+ ```
176
+
177
+ ### Format
178
+
179
+ Default date format is `mm/dd/yy` which can be customized using the `dateFormat` property. Following options can be a part of the format.
180
+
181
+ <ul className="mb-6 leading-loose">
182
+ <li>`d` - day of month (no leading zero)</li>
183
+ <li>`dd` - day of month (two digit)</li>
184
+ <li>`o` - day of the year (no leading zeros)</li>
185
+ <li>`oo` - day of the year (three digit)</li>
186
+ <li>`D` - day name short</li>
187
+ <li>`DD` - day name long</li>
188
+ <li>`m` - month of year (no leading zero)</li>
189
+ <li>`mm` - month of year (two digit)</li>
190
+ <li>`M` - month name short</li>
191
+ <li>`MM` - month name long</li>
192
+ <li>`y` - year (two digit)</li>
193
+ <li>`yy` - year (four digit)</li>
194
+ <li>`@` - Unix timestamp (ms since 01/01/1970)</li>
195
+ <li>`!` - Windows ticks (100ns since 01/01/0001)</li>
196
+ <li>`'...'` - literal text</li>
197
+ <li>`''` - single quote</li>
198
+ <li>`anything else` - literal text</li>
199
+ </ul>
200
+
201
+ ```tsx
202
+ 'use client';
203
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
204
+ import { ChevronRight } from '@primeicons/react/chevron-right';
205
+ import { Button } from '@primereact/ui/button';
206
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
207
+ import { InputText } from '@primereact/ui/inputtext';
208
+ import * as React from 'react';
209
+
210
+ export default function FormatDemo() {
211
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
212
+
213
+ return (
214
+ <div className="flex justify-center">
215
+ <DatePicker.Root value={date} dateFormat="dd/mm/yy" onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
216
+ <DatePicker.Input as={InputText} />
217
+ <DatePicker.Portal>
218
+ <DatePicker.Positioner>
219
+ <DatePicker.Popup>
220
+ <DatePicker.Body>
221
+ <DatePicker.Panel>
222
+ <DatePicker.Calendar>
223
+ <DatePicker.Header>
224
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
225
+ <ChevronLeft />
226
+ </DatePicker.Prev>
227
+ <DatePicker.Title>
228
+ <DatePicker.SelectMonth />
229
+ <DatePicker.SelectYear />
230
+ <DatePicker.Decade />
231
+ </DatePicker.Title>
232
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
233
+ <ChevronRight />
234
+ </DatePicker.Next>
235
+ </DatePicker.Header>
236
+ <DatePicker.Table>
237
+ <DatePicker.TableHead />
238
+ <DatePicker.TableBody />
239
+ <DatePicker.TableBody view="month" />
240
+ <DatePicker.TableBody view="year" />
241
+ </DatePicker.Table>
242
+ </DatePicker.Calendar>
243
+ </DatePicker.Panel>
244
+ </DatePicker.Body>
245
+ </DatePicker.Popup>
246
+ </DatePicker.Positioner>
247
+ </DatePicker.Portal>
248
+ </DatePicker.Root>
249
+ </div>
250
+ );
251
+ }
252
+ ```
253
+
254
+ ### Icon
255
+
256
+ An additional icon is displayed next to the input field.
257
+
258
+ ```tsx
259
+ 'use client';
260
+ import { Calendar } from '@primeicons/react/calendar';
261
+ import { ChevronDown } from '@primeicons/react/chevron-down';
262
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
263
+ import { ChevronRight } from '@primeicons/react/chevron-right';
264
+ import { ChevronUp } from '@primeicons/react/chevron-up';
265
+ import { Clock } from '@primeicons/react/clock';
266
+ import { Button } from '@primereact/ui/button';
267
+ import { DatePicker, type DatePickerOpenChangeEvent, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
268
+ import { IconField } from '@primereact/ui/iconfield';
269
+ import { InputText } from '@primereact/ui/inputtext';
270
+ import { Label } from '@primereact/ui/label';
271
+ import * as React from 'react';
272
+
273
+ export default function IconDemo() {
274
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
275
+ const [date2, setDate2] = React.useState<DatePickerRootProps['value'] | null>(null);
276
+ const [date3, setDate3] = React.useState<DatePickerRootProps['value'] | null>(null);
277
+
278
+ const [opened, setOpened] = React.useState(false);
279
+ const [opened2, setOpened2] = React.useState(false);
280
+
281
+ return (
282
+ <div className="flex flex-wrap gap-4">
283
+ <div className="flex-auto">
284
+ <Label htmlFor="buttondisplay" className="text-sm font-bold block mb-2">
285
+ Button
286
+ </Label>
287
+ <DatePicker.Root value={date} fluid onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
288
+ <DatePicker.Input as={InputText} id="buttondisplay" />
289
+ <DatePicker.Trigger>
290
+ <Calendar />
291
+ </DatePicker.Trigger>
292
+ <DatePicker.Portal>
293
+ <DatePicker.Positioner>
294
+ <DatePicker.Popup>
295
+ <DatePicker.Body>
296
+ <DatePicker.Panel>
297
+ <DatePicker.Calendar>
298
+ <DatePicker.Header>
299
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
300
+ <ChevronLeft />
301
+ </DatePicker.Prev>
302
+ <DatePicker.Title>
303
+ <DatePicker.SelectMonth />
304
+ <DatePicker.SelectYear />
305
+ <DatePicker.Decade />
306
+ </DatePicker.Title>
307
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
308
+ <ChevronRight />
309
+ </DatePicker.Next>
310
+ </DatePicker.Header>
311
+ <DatePicker.Table>
312
+ <DatePicker.TableHead />
313
+ <DatePicker.TableBody />
314
+ <DatePicker.TableBody view="month" />
315
+ <DatePicker.TableBody view="year" />
316
+ </DatePicker.Table>
317
+ </DatePicker.Calendar>
318
+ </DatePicker.Panel>
319
+ </DatePicker.Body>
320
+ </DatePicker.Popup>
321
+ </DatePicker.Positioner>
322
+ </DatePicker.Portal>
323
+ </DatePicker.Root>
324
+ </div>
325
+ <div className="flex-auto">
326
+ <Label htmlFor="icondisplay" className="text-sm font-bold block mb-2">
327
+ Icon Field
328
+ </Label>
329
+ <DatePicker.Root
330
+ value={date2}
331
+ open={opened}
332
+ fluid
333
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate2(event.value)}
334
+ onOpenChange={(event: DatePickerOpenChangeEvent) => setOpened(event.value)}
335
+ >
336
+ <IconField.Root className="w-full">
337
+ <DatePicker.Input as={InputText} id="icondisplay" fluid />
338
+ <IconField.Inset>
339
+ <Calendar className="cursor-pointer" onClick={() => setOpened((prev) => !prev)} />
340
+ </IconField.Inset>
341
+ </IconField.Root>
342
+
343
+ <DatePicker.Portal>
344
+ <DatePicker.Positioner>
345
+ <DatePicker.Popup>
346
+ <DatePicker.Body>
347
+ <DatePicker.Panel>
348
+ <DatePicker.Calendar>
349
+ <DatePicker.Header>
350
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
351
+ <ChevronLeft />
352
+ </DatePicker.Prev>
353
+ <DatePicker.Title>
354
+ <DatePicker.SelectMonth />
355
+ <DatePicker.SelectYear />
356
+ <DatePicker.Decade />
357
+ </DatePicker.Title>
358
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
359
+ <ChevronRight />
360
+ </DatePicker.Next>
361
+ </DatePicker.Header>
362
+ <DatePicker.Table>
363
+ <DatePicker.TableHead />
364
+ <DatePicker.TableBody />
365
+ <DatePicker.TableBody view="month" />
366
+ <DatePicker.TableBody view="year" />
367
+ </DatePicker.Table>
368
+ </DatePicker.Calendar>
369
+ </DatePicker.Panel>
370
+ </DatePicker.Body>
371
+ </DatePicker.Popup>
372
+ </DatePicker.Positioner>
373
+ </DatePicker.Portal>
374
+ </DatePicker.Root>
375
+ </div>
376
+ <div className="flex-auto">
377
+ <Label htmlFor="templatedisplay" className="text-sm font-bold block mb-2">
378
+ Custom Icon
379
+ </Label>
380
+ <DatePicker.Root
381
+ value={date3}
382
+ open={opened2}
383
+ fluid
384
+ timeOnly
385
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate3(event.value)}
386
+ onOpenChange={(event: DatePickerOpenChangeEvent) => setOpened2(event.value)}
387
+ >
388
+ <IconField.Root className="w-full">
389
+ <DatePicker.Input as={InputText} id="templatedisplay" fluid />
390
+ <IconField.Inset>
391
+ <Clock className="cursor-pointer" onClick={() => setOpened2((prev) => !prev)} />
392
+ </IconField.Inset>
393
+ </IconField.Root>
394
+
395
+ <DatePicker.Portal>
396
+ <DatePicker.Positioner>
397
+ <DatePicker.Popup>
398
+ <DatePicker.Body>
399
+ <DatePicker.Panel>
400
+ <DatePicker.Time>
401
+ <DatePicker.Picker type="hour">
402
+ <DatePicker.Increment as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
403
+ <ChevronUp />
404
+ </DatePicker.Increment>
405
+ <DatePicker.Hour />
406
+ <DatePicker.Decrement as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
407
+ <ChevronDown />
408
+ </DatePicker.Decrement>
409
+ </DatePicker.Picker>
410
+ <DatePicker.Separator />
411
+ <DatePicker.Picker type="minute">
412
+ <DatePicker.Increment as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
413
+ <ChevronUp />
414
+ </DatePicker.Increment>
415
+ <DatePicker.Minute />
416
+ <DatePicker.Decrement as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
417
+ <ChevronDown />
418
+ </DatePicker.Decrement>
419
+ </DatePicker.Picker>
420
+ </DatePicker.Time>
421
+ </DatePicker.Panel>
422
+ </DatePicker.Body>
423
+ </DatePicker.Popup>
424
+ </DatePicker.Positioner>
425
+ </DatePicker.Portal>
426
+ </DatePicker.Root>
427
+ </div>
428
+ </div>
429
+ );
430
+ }
431
+ ```
432
+
433
+ ### Value & Trigger
434
+
435
+ Use `DatePicker.Trigger` and `DatePicker.Value` to build custom trigger UIs without the default input. Supports date range pickers with formatted display, multi-date selection with removable chips, and custom trigger buttons with flexible layouts.
436
+
437
+ ```tsx
438
+ 'use client';
439
+ import { ArrowRight } from '@primeicons/react/arrow-right';
440
+ import { Calendar } from '@primeicons/react/calendar';
441
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
442
+ import { ChevronRight } from '@primeicons/react/chevron-right';
443
+ import { Times } from '@primeicons/react/times';
444
+ import { Button } from '@primereact/ui/button';
445
+ import { Chip, type ChipRootRemoveEvent } from '@primereact/ui/chip';
446
+ import { DatePicker, type DatePickerOpenChangeEvent, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
447
+ import { Label } from '@primereact/ui/label';
448
+ import * as React from 'react';
449
+
450
+ const formatShortDate = (date: Date) => {
451
+ return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
452
+ };
453
+
454
+ export default function ValueTriggerDemo() {
455
+ const [rangeDate, setRangeDate] = React.useState<DatePickerRootProps['value']>(null);
456
+ const [multipleDates, setMultipleDates] = React.useState<DatePickerRootProps['value']>(null);
457
+ const [singleDate, setSingleDate] = React.useState<DatePickerRootProps['value']>(null);
458
+ const [opened, setOpened] = React.useState(false);
459
+ const [opened2, setOpened2] = React.useState(false);
460
+ const [opened3, setOpened3] = React.useState(false);
461
+
462
+ const removeDate = (e: ChipRootRemoveEvent, target: Date) => {
463
+ e.originalEvent.stopPropagation();
464
+
465
+ if (Array.isArray(multipleDates)) {
466
+ const dates = multipleDates as Date[];
467
+
468
+ setMultipleDates(dates.filter((d) => d.getTime() !== target.getTime()));
469
+ }
470
+ };
471
+
472
+ const clearRange = (e: React.MouseEvent) => {
473
+ e.stopPropagation();
474
+ setRangeDate(null);
475
+ };
476
+
477
+ const rangeDates = Array.isArray(rangeDate) ? (rangeDate as Date[]) : [];
478
+ const multiDates = Array.isArray(multipleDates) ? (multipleDates as Date[]) : [];
479
+
480
+ return (
481
+ <div className="flex flex-col gap-8">
482
+ <div className="flex flex-col gap-2">
483
+ <Label className="text-sm font-bold">Date Range Picker</Label>
484
+ <DatePicker.Root
485
+ value={rangeDate}
486
+ selectionMode="range"
487
+ manualInput={false}
488
+ numberOfMonths={2}
489
+ open={opened}
490
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setRangeDate(event.value)}
491
+ onOpenChange={(event: DatePickerOpenChangeEvent) => setOpened(event.value)}
492
+ >
493
+ <DatePicker.Trigger
494
+ as="div"
495
+ className="flex! items-center gap-2 cursor-pointer w-full! md:w-80! border! border-surface! rounded-md! bg-(--p-inputtext-background)! px-3 py-2 text-sm hover:border-(--p-inputtext-hover-border-color)! focus-visible:border-(--p-inputtext-focus-border-color)! transition-colors"
496
+ >
497
+ <Calendar className="text-surface-500 shrink-0" />
498
+ <DatePicker.Value placeholder="Select date range">
499
+ {rangeDates.length > 0 && (
500
+ <span className="flex items-center gap-2 text-sm">
501
+ <span className="font-medium">{formatShortDate(rangeDates[0])}</span>
502
+ {rangeDates[1] && (
503
+ <>
504
+ <ArrowRight className="text-xs text-surface-400" />
505
+ <span className="font-medium">{formatShortDate(rangeDates[1])}</span>
506
+ </>
507
+ )}
508
+ </span>
509
+ )}
510
+ </DatePicker.Value>
511
+ {rangeDates.length > 0 && (
512
+ <button
513
+ type="button"
514
+ className="ml-auto p-0.5 rounded-full hover:bg-surface-100 dark:hover:bg-surface-700 transition-colors"
515
+ onClick={clearRange}
516
+ aria-label="Clear date range"
517
+ >
518
+ <Times className="text-xs text-surface-400" />
519
+ </button>
520
+ )}
521
+ </DatePicker.Trigger>
522
+ <DatePicker.Portal>
523
+ <DatePicker.Positioner>
524
+ <DatePicker.Popup>
525
+ <DatePicker.Body>
526
+ <DatePicker.Panel>
527
+ <DatePicker.Calendar>
528
+ <DatePicker.Header>
529
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
530
+ <ChevronLeft />
531
+ </DatePicker.Prev>
532
+ <DatePicker.Title>
533
+ <DatePicker.SelectMonth />
534
+ <DatePicker.SelectYear />
535
+ <DatePicker.Decade />
536
+ </DatePicker.Title>
537
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
538
+ <ChevronRight />
539
+ </DatePicker.Next>
540
+ </DatePicker.Header>
541
+ <DatePicker.Table>
542
+ <DatePicker.TableHead />
543
+ <DatePicker.TableBody />
544
+ <DatePicker.TableBody view="month" />
545
+ <DatePicker.TableBody view="year" />
546
+ </DatePicker.Table>
547
+ </DatePicker.Calendar>
548
+ </DatePicker.Panel>
549
+ </DatePicker.Body>
550
+ </DatePicker.Popup>
551
+ </DatePicker.Positioner>
552
+ </DatePicker.Portal>
553
+ </DatePicker.Root>
554
+ </div>
555
+
556
+ <div className="flex flex-col gap-2">
557
+ <Label className="text-sm font-bold">Multiple Dates with Chips</Label>
558
+ <DatePicker.Root
559
+ value={multipleDates}
560
+ selectionMode="multiple"
561
+ manualInput={false}
562
+ open={opened2}
563
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setMultipleDates(event.value)}
564
+ onOpenChange={(event: DatePickerOpenChangeEvent) => setOpened2(event.value)}
565
+ >
566
+ <DatePicker.Trigger
567
+ as="div"
568
+ className="flex! items-center gap-1 cursor-pointer min-h-10 w-full! md:w-150! border! border-surface! rounded-md! bg-(--p-inputtext-background)! px-3 py-2 text-sm hover:border-(--p-inputtext-hover-border-color)! focus-visible:border-(--p-inputtext-focus-border-color)! transition-colors"
569
+ >
570
+ <DatePicker.Value placeholder="Pick dates...">
571
+ <div className="flex flex-wrap gap-1">
572
+ {multiDates.map((date) => (
573
+ <Chip.Root key={date.getTime()} className="py-0.5" onRemove={(e: ChipRootRemoveEvent) => removeDate(e, date)}>
574
+ <Chip.Label className="text-xs">{formatShortDate(date)}</Chip.Label>
575
+ <Chip.Remove>
576
+ <Times className="text-[0.5rem]!" />
577
+ </Chip.Remove>
578
+ </Chip.Root>
579
+ ))}
580
+ </div>
581
+ </DatePicker.Value>
582
+ <Calendar className="ml-auto text-surface-500 shrink-0" />
583
+ </DatePicker.Trigger>
584
+ <DatePicker.Portal>
585
+ <DatePicker.Positioner>
586
+ <DatePicker.Popup>
587
+ <DatePicker.Body>
588
+ <DatePicker.Panel>
589
+ <DatePicker.Calendar>
590
+ <DatePicker.Header>
591
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
592
+ <ChevronLeft />
593
+ </DatePicker.Prev>
594
+ <DatePicker.Title>
595
+ <DatePicker.SelectMonth />
596
+ <DatePicker.SelectYear />
597
+ <DatePicker.Decade />
598
+ </DatePicker.Title>
599
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
600
+ <ChevronRight />
601
+ </DatePicker.Next>
602
+ </DatePicker.Header>
603
+ <DatePicker.Table>
604
+ <DatePicker.TableHead />
605
+ <DatePicker.TableBody />
606
+ <DatePicker.TableBody view="month" />
607
+ <DatePicker.TableBody view="year" />
608
+ </DatePicker.Table>
609
+ </DatePicker.Calendar>
610
+ </DatePicker.Panel>
611
+ </DatePicker.Body>
612
+ </DatePicker.Popup>
613
+ </DatePicker.Positioner>
614
+ </DatePicker.Portal>
615
+ </DatePicker.Root>
616
+ </div>
617
+
618
+ <div className="flex flex-col gap-2">
619
+ <Label className="text-sm font-bold">Custom Trigger Button</Label>
620
+ <DatePicker.Root
621
+ value={singleDate}
622
+ open={opened3}
623
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setSingleDate(event.value)}
624
+ onOpenChange={(event: DatePickerOpenChangeEvent) => setOpened3(event.value)}
625
+ >
626
+ <DatePicker.Trigger as={Button} variant="outlined" severity="secondary" iconOnly className="border!">
627
+ <Calendar />
628
+ </DatePicker.Trigger>
629
+ <DatePicker.Portal>
630
+ <DatePicker.Positioner>
631
+ <DatePicker.Popup>
632
+ <DatePicker.Body>
633
+ <DatePicker.Panel>
634
+ <DatePicker.Calendar>
635
+ <DatePicker.Header>
636
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
637
+ <ChevronLeft />
638
+ </DatePicker.Prev>
639
+ <DatePicker.Title>
640
+ <DatePicker.SelectMonth />
641
+ <DatePicker.SelectYear />
642
+ <DatePicker.Decade />
643
+ </DatePicker.Title>
644
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
645
+ <ChevronRight />
646
+ </DatePicker.Next>
647
+ </DatePicker.Header>
648
+ <DatePicker.Table>
649
+ <DatePicker.TableHead />
650
+ <DatePicker.TableBody />
651
+ <DatePicker.TableBody view="month" />
652
+ <DatePicker.TableBody view="year" />
653
+ </DatePicker.Table>
654
+ </DatePicker.Calendar>
655
+ </DatePicker.Panel>
656
+ </DatePicker.Body>
657
+ </DatePicker.Popup>
658
+ </DatePicker.Positioner>
659
+ </DatePicker.Portal>
660
+ </DatePicker.Root>
661
+ </div>
662
+ </div>
663
+ );
664
+ }
665
+ ```
666
+
667
+ ### Min / Max
668
+
669
+ Boundaries for the permitted dates that can be entered are defined with `minDate` and `maxDate` properties.
670
+
671
+ ```tsx
672
+ 'use client';
673
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
674
+ import { ChevronRight } from '@primeicons/react/chevron-right';
675
+ import { Button } from '@primereact/ui/button';
676
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
677
+ import { InputText } from '@primereact/ui/inputtext';
678
+ import * as React from 'react';
679
+
680
+ export default function MinMaxDemo() {
681
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
682
+ const today = new Date();
683
+ const month = today.getMonth();
684
+ const year = today.getFullYear();
685
+ const prevMonth = month === 0 ? 11 : month - 1;
686
+ const prevYear = prevMonth === 11 ? year - 1 : year;
687
+ const nextMonth = month === 11 ? 0 : month + 1;
688
+ const nextYear = nextMonth === 0 ? year + 1 : year;
689
+ const minDate = new Date();
690
+ const maxDate = new Date();
691
+
692
+ minDate.setMonth(prevMonth);
693
+ minDate.setFullYear(prevYear);
694
+
695
+ maxDate.setMonth(nextMonth);
696
+ maxDate.setFullYear(nextYear);
697
+
698
+ return (
699
+ <div className="flex justify-center">
700
+ <DatePicker.Root
701
+ value={date}
702
+ minDate={minDate}
703
+ maxDate={maxDate}
704
+ manualInput={false}
705
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}
706
+ >
707
+ <DatePicker.Input as={InputText} />
708
+ <DatePicker.Portal>
709
+ <DatePicker.Positioner>
710
+ <DatePicker.Popup>
711
+ <DatePicker.Body>
712
+ <DatePicker.Panel>
713
+ <DatePicker.Calendar>
714
+ <DatePicker.Header>
715
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
716
+ <ChevronLeft />
717
+ </DatePicker.Prev>
718
+ <DatePicker.Title>
719
+ <DatePicker.SelectMonth />
720
+ <DatePicker.SelectYear />
721
+ <DatePicker.Decade />
722
+ </DatePicker.Title>
723
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
724
+ <ChevronRight />
725
+ </DatePicker.Next>
726
+ </DatePicker.Header>
727
+ <DatePicker.Table>
728
+ <DatePicker.TableHead />
729
+ <DatePicker.TableBody />
730
+ <DatePicker.TableBody view="month" />
731
+ <DatePicker.TableBody view="year" />
732
+ </DatePicker.Table>
733
+ </DatePicker.Calendar>
734
+ </DatePicker.Panel>
735
+ </DatePicker.Body>
736
+ </DatePicker.Popup>
737
+ </DatePicker.Positioner>
738
+ </DatePicker.Portal>
739
+ </DatePicker.Root>
740
+ </div>
741
+ );
742
+ }
743
+ ```
744
+
745
+ ### Multiple
746
+
747
+ In order to choose multiple dates, set `selectionMode` as `multiple`. In this mode, the value binding should be an array.
748
+
749
+ ```tsx
750
+ 'use client';
751
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
752
+ import { ChevronRight } from '@primeicons/react/chevron-right';
753
+ import { Button } from '@primereact/ui/button';
754
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
755
+
756
+ import { InputText } from '@primereact/ui/inputtext';
757
+ import * as React from 'react';
758
+
759
+ export default function MultipleDemo() {
760
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
761
+
762
+ return (
763
+ <div className="flex justify-center">
764
+ <DatePicker.Root
765
+ value={date}
766
+ selectionMode="multiple"
767
+ manualInput={false}
768
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}
769
+ >
770
+ <DatePicker.Input as={InputText} />
771
+ <DatePicker.Portal>
772
+ <DatePicker.Positioner>
773
+ <DatePicker.Popup>
774
+ <DatePicker.Body>
775
+ <DatePicker.Panel>
776
+ <DatePicker.Calendar>
777
+ <DatePicker.Header>
778
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
779
+ <ChevronLeft />
780
+ </DatePicker.Prev>
781
+ <DatePicker.Title>
782
+ <DatePicker.SelectMonth />
783
+ <DatePicker.SelectYear />
784
+ <DatePicker.Decade />
785
+ </DatePicker.Title>
786
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
787
+ <ChevronRight />
788
+ </DatePicker.Next>
789
+ </DatePicker.Header>
790
+ <DatePicker.Table>
791
+ <DatePicker.TableHead />
792
+ <DatePicker.TableBody />
793
+ <DatePicker.TableBody view="month" />
794
+ <DatePicker.TableBody view="year" />
795
+ </DatePicker.Table>
796
+ </DatePicker.Calendar>
797
+ </DatePicker.Panel>
798
+ </DatePicker.Body>
799
+ </DatePicker.Popup>
800
+ </DatePicker.Positioner>
801
+ </DatePicker.Portal>
802
+ </DatePicker.Root>
803
+ </div>
804
+ );
805
+ }
806
+ ```
807
+
808
+ ### Range
809
+
810
+ A range of dates can be selected by defining `selectionMode` as `range`, in this case the bound value would be an array with two values where first date is the start of the range and second date is the end.
811
+
812
+ ```tsx
813
+ 'use client';
814
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
815
+ import { ChevronRight } from '@primeicons/react/chevron-right';
816
+ import { Button } from '@primereact/ui/button';
817
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
818
+
819
+ import { InputText } from '@primereact/ui/inputtext';
820
+ import * as React from 'react';
821
+
822
+ export default function RangeDemo() {
823
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
824
+
825
+ return (
826
+ <div className="flex justify-center">
827
+ <DatePicker.Root
828
+ value={date}
829
+ selectionMode="range"
830
+ manualInput={false}
831
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}
832
+ >
833
+ <DatePicker.Input as={InputText} />
834
+ <DatePicker.Portal>
835
+ <DatePicker.Positioner>
836
+ <DatePicker.Popup>
837
+ <DatePicker.Body>
838
+ <DatePicker.Panel>
839
+ <DatePicker.Calendar>
840
+ <DatePicker.Header>
841
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
842
+ <ChevronLeft />
843
+ </DatePicker.Prev>
844
+ <DatePicker.Title>
845
+ <DatePicker.SelectMonth />
846
+ <DatePicker.SelectYear />
847
+ <DatePicker.Decade />
848
+ </DatePicker.Title>
849
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
850
+ <ChevronRight />
851
+ </DatePicker.Next>
852
+ </DatePicker.Header>
853
+ <DatePicker.Table>
854
+ <DatePicker.TableHead />
855
+ <DatePicker.TableBody />
856
+ <DatePicker.TableBody view="month" />
857
+ <DatePicker.TableBody view="year" />
858
+ </DatePicker.Table>
859
+ </DatePicker.Calendar>
860
+ </DatePicker.Panel>
861
+ </DatePicker.Body>
862
+ </DatePicker.Popup>
863
+ </DatePicker.Positioner>
864
+ </DatePicker.Portal>
865
+ </DatePicker.Root>
866
+ </div>
867
+ );
868
+ }
869
+ ```
870
+
871
+ ### Button Bar
872
+
873
+ When `Buttonbar` component is used, today and clear buttons are displayed at the bottom of the calendar panel.
874
+
875
+ ```tsx
876
+ 'use client';
877
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
878
+ import { ChevronRight } from '@primeicons/react/chevron-right';
879
+ import { Times } from '@primeicons/react/times';
880
+ import { Button } from '@primereact/ui/button';
881
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
882
+ import { InputText } from '@primereact/ui/inputtext';
883
+ import * as React from 'react';
884
+
885
+ export default function ButtonbarDemo() {
886
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
887
+ const [date2, setDate2] = React.useState<DatePickerRootProps['value'] | null>(null);
888
+
889
+ return (
890
+ <div className="flex justify-center gap-4 flex-wrap">
891
+ <DatePicker.Root value={date} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
892
+ <DatePicker.Input as={InputText} placeholder="Basic" />
893
+ <DatePicker.Portal>
894
+ <DatePicker.Positioner>
895
+ <DatePicker.Popup>
896
+ <DatePicker.Body>
897
+ <DatePicker.Panel>
898
+ <DatePicker.Calendar>
899
+ <DatePicker.Header>
900
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
901
+ <ChevronLeft />
902
+ </DatePicker.Prev>
903
+ <DatePicker.Title>
904
+ <DatePicker.SelectMonth />
905
+ <DatePicker.SelectYear />
906
+ <DatePicker.Decade />
907
+ </DatePicker.Title>
908
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
909
+ <ChevronRight />
910
+ </DatePicker.Next>
911
+ </DatePicker.Header>
912
+ <DatePicker.Table>
913
+ <DatePicker.TableHead />
914
+ <DatePicker.TableBody />
915
+ <DatePicker.TableBody view="month" />
916
+ <DatePicker.TableBody view="year" />
917
+ </DatePicker.Table>
918
+ </DatePicker.Calendar>
919
+ <DatePicker.Buttonbar>
920
+ <DatePicker.Today as={Button} variant="text" severity="secondary" size="small">
921
+ Today
922
+ </DatePicker.Today>
923
+ <DatePicker.ClearTrigger as={Button} variant="text" severity="secondary" size="small">
924
+ Clear
925
+ </DatePicker.ClearTrigger>
926
+ </DatePicker.Buttonbar>
927
+ </DatePicker.Panel>
928
+ </DatePicker.Body>
929
+ </DatePicker.Popup>
930
+ </DatePicker.Positioner>
931
+ </DatePicker.Portal>
932
+ </DatePicker.Root>
933
+ <DatePicker.Root
934
+ value={date2}
935
+ selectionMode="range"
936
+ manualInput={false}
937
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate2(event.value)}
938
+ >
939
+ <DatePicker.Input as={InputText} placeholder="Customized" />
940
+ <DatePicker.Portal>
941
+ <DatePicker.Positioner>
942
+ <DatePicker.Popup>
943
+ <DatePicker.Body>
944
+ <DatePicker.Panel>
945
+ <DatePicker.Calendar>
946
+ <DatePicker.Header>
947
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
948
+ <ChevronLeft />
949
+ </DatePicker.Prev>
950
+ <DatePicker.Title>
951
+ <DatePicker.SelectMonth />
952
+ <DatePicker.SelectYear />
953
+ <DatePicker.Decade />
954
+ </DatePicker.Title>
955
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
956
+ <ChevronRight />
957
+ </DatePicker.Next>
958
+ </DatePicker.Header>
959
+ <DatePicker.Table>
960
+ <DatePicker.TableHead />
961
+ <DatePicker.TableBody />
962
+ <DatePicker.TableBody view="month" />
963
+ <DatePicker.TableBody view="year" />
964
+ </DatePicker.Table>
965
+ </DatePicker.Calendar>
966
+ <DatePicker.Buttonbar>
967
+ <div className="flex justify-between w-full">
968
+ <div className="flex gap-2">
969
+ <Button size="small" severity="secondary">
970
+ Exact
971
+ </Button>
972
+ <Button size="small" severity="secondary">
973
+ Flexible
974
+ </Button>
975
+ </div>
976
+ <div className="flex gap-2">
977
+ <DatePicker.Today as={Button} variant="outlined" severity="secondary" size="small">
978
+ Today
979
+ </DatePicker.Today>
980
+ <DatePicker.ClearTrigger as={Button} variant="outlined" severity="danger" size="small" iconOnly>
981
+ <Times />
982
+ </DatePicker.ClearTrigger>
983
+ </div>
984
+ </div>
985
+ </DatePicker.Buttonbar>
986
+ </DatePicker.Panel>
987
+ </DatePicker.Body>
988
+ </DatePicker.Popup>
989
+ </DatePicker.Positioner>
990
+ </DatePicker.Portal>
991
+ </DatePicker.Root>
992
+ </div>
993
+ );
994
+ }
995
+ ```
996
+
997
+ ### Time
998
+
999
+ A time picker is displayed when `DatePicker.Time` component is used where 12/24 hour format is configured with `hourFormat` property. In case, only time needs to be selected, add `timeOnly` to hide the date section.
1000
+
1001
+ ```tsx
1002
+ 'use client';
1003
+ import { ChevronDown } from '@primeicons/react/chevron-down';
1004
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
1005
+ import { ChevronRight } from '@primeicons/react/chevron-right';
1006
+ import { ChevronUp } from '@primeicons/react/chevron-up';
1007
+ import { Button } from '@primereact/ui/button';
1008
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
1009
+ import { InputText } from '@primereact/ui/inputtext';
1010
+ import { Label } from '@primereact/ui/label';
1011
+ import * as React from 'react';
1012
+
1013
+ export default function TimeDemo() {
1014
+ const [date1, setDate1] = React.useState<DatePickerRootProps['value'] | null>(null);
1015
+ const [date2, setDate2] = React.useState<DatePickerRootProps['value'] | null>(null);
1016
+ const [date3, setDate3] = React.useState<DatePickerRootProps['value'] | null>(null);
1017
+
1018
+ return (
1019
+ <>
1020
+ <div className="flex flex-wrap gap-4">
1021
+ <div className="flex-auto">
1022
+ <Label htmlFor="datepicker-12h" className="text-sm font-bold block mb-2">
1023
+ 12h Format
1024
+ </Label>
1025
+ <DatePicker.Root
1026
+ value={date1}
1027
+ showTime
1028
+ hourFormat="12"
1029
+ fluid
1030
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate1(event.value)}
1031
+ >
1032
+ <DatePicker.Input as={InputText} id="datepicker-12h" fluid />
1033
+ <DatePicker.Portal>
1034
+ <DatePicker.Positioner>
1035
+ <DatePicker.Popup>
1036
+ <DatePicker.Body>
1037
+ <DatePicker.Panel>
1038
+ <DatePicker.Calendar>
1039
+ <DatePicker.Header>
1040
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1041
+ <ChevronLeft />
1042
+ </DatePicker.Prev>
1043
+ <DatePicker.Title>
1044
+ <DatePicker.SelectMonth />
1045
+ <DatePicker.SelectYear />
1046
+ <DatePicker.Decade />
1047
+ </DatePicker.Title>
1048
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1049
+ <ChevronRight />
1050
+ </DatePicker.Next>
1051
+ </DatePicker.Header>
1052
+ <DatePicker.Table>
1053
+ <DatePicker.TableHead />
1054
+ <DatePicker.TableBody />
1055
+ <DatePicker.TableBody view="month" />
1056
+ <DatePicker.TableBody view="year" />
1057
+ </DatePicker.Table>
1058
+ </DatePicker.Calendar>
1059
+ <DatePicker.Time>
1060
+ <DatePicker.Picker type="hour">
1061
+ <DatePicker.Increment
1062
+ as={Button}
1063
+ iconOnly
1064
+ variant="text"
1065
+ rounded
1066
+ severity="secondary"
1067
+ size="small"
1068
+ >
1069
+ <ChevronUp />
1070
+ </DatePicker.Increment>
1071
+ <DatePicker.Hour />
1072
+ <DatePicker.Decrement
1073
+ as={Button}
1074
+ iconOnly
1075
+ variant="text"
1076
+ rounded
1077
+ severity="secondary"
1078
+ size="small"
1079
+ >
1080
+ <ChevronDown />
1081
+ </DatePicker.Decrement>
1082
+ </DatePicker.Picker>
1083
+
1084
+ <DatePicker.Separator />
1085
+
1086
+ <DatePicker.Picker type="minute">
1087
+ <DatePicker.Increment
1088
+ as={Button}
1089
+ iconOnly
1090
+ variant="text"
1091
+ rounded
1092
+ severity="secondary"
1093
+ size="small"
1094
+ >
1095
+ <ChevronUp />
1096
+ </DatePicker.Increment>
1097
+ <DatePicker.Minute />
1098
+ <DatePicker.Decrement
1099
+ as={Button}
1100
+ iconOnly
1101
+ variant="text"
1102
+ rounded
1103
+ severity="secondary"
1104
+ size="small"
1105
+ >
1106
+ <ChevronDown />
1107
+ </DatePicker.Decrement>
1108
+ </DatePicker.Picker>
1109
+
1110
+ <DatePicker.Separator />
1111
+
1112
+ <DatePicker.Picker type="ampm">
1113
+ <DatePicker.Increment
1114
+ as={Button}
1115
+ iconOnly
1116
+ variant="text"
1117
+ rounded
1118
+ severity="secondary"
1119
+ size="small"
1120
+ >
1121
+ <ChevronUp />
1122
+ </DatePicker.Increment>
1123
+ <DatePicker.AmPm />
1124
+ <DatePicker.Decrement
1125
+ as={Button}
1126
+ iconOnly
1127
+ variant="text"
1128
+ rounded
1129
+ severity="secondary"
1130
+ size="small"
1131
+ >
1132
+ <ChevronDown />
1133
+ </DatePicker.Decrement>
1134
+ </DatePicker.Picker>
1135
+ </DatePicker.Time>
1136
+ </DatePicker.Panel>
1137
+ </DatePicker.Body>
1138
+ </DatePicker.Popup>
1139
+ </DatePicker.Positioner>
1140
+ </DatePicker.Portal>
1141
+ </DatePicker.Root>
1142
+ </div>
1143
+ <div className="flex-auto">
1144
+ <Label htmlFor="datepicker-24h" className="text-sm font-bold block mb-2">
1145
+ 24h Format
1146
+ </Label>
1147
+ <DatePicker.Root
1148
+ value={date2}
1149
+ showTime
1150
+ hourFormat="24"
1151
+ fluid
1152
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate2(event.value)}
1153
+ >
1154
+ <DatePicker.Input as={InputText} id="datepicker-24h" fluid />
1155
+ <DatePicker.Portal>
1156
+ <DatePicker.Positioner>
1157
+ <DatePicker.Popup>
1158
+ <DatePicker.Body>
1159
+ <DatePicker.Panel>
1160
+ <DatePicker.Calendar>
1161
+ <DatePicker.Header>
1162
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1163
+ <ChevronLeft />
1164
+ </DatePicker.Prev>
1165
+ <DatePicker.Title>
1166
+ <DatePicker.SelectMonth />
1167
+ <DatePicker.SelectYear />
1168
+ <DatePicker.Decade />
1169
+ </DatePicker.Title>
1170
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1171
+ <ChevronRight />
1172
+ </DatePicker.Next>
1173
+ </DatePicker.Header>
1174
+ <DatePicker.Table>
1175
+ <DatePicker.TableHead />
1176
+ <DatePicker.TableBody />
1177
+ <DatePicker.TableBody view="month" />
1178
+ <DatePicker.TableBody view="year" />
1179
+ </DatePicker.Table>
1180
+ </DatePicker.Calendar>
1181
+ <DatePicker.Time>
1182
+ <DatePicker.Picker type="hour">
1183
+ <DatePicker.Increment
1184
+ as={Button}
1185
+ iconOnly
1186
+ variant="text"
1187
+ rounded
1188
+ severity="secondary"
1189
+ size="small"
1190
+ >
1191
+ <ChevronUp />
1192
+ </DatePicker.Increment>
1193
+ <DatePicker.Hour />
1194
+ <DatePicker.Decrement
1195
+ as={Button}
1196
+ iconOnly
1197
+ variant="text"
1198
+ rounded
1199
+ severity="secondary"
1200
+ size="small"
1201
+ >
1202
+ <ChevronDown />
1203
+ </DatePicker.Decrement>
1204
+ </DatePicker.Picker>
1205
+ <DatePicker.Separator />
1206
+ <DatePicker.Picker type="minute">
1207
+ <DatePicker.Increment
1208
+ as={Button}
1209
+ iconOnly
1210
+ variant="text"
1211
+ rounded
1212
+ severity="secondary"
1213
+ size="small"
1214
+ >
1215
+ <ChevronUp />
1216
+ </DatePicker.Increment>
1217
+ <DatePicker.Minute />
1218
+ <DatePicker.Decrement
1219
+ as={Button}
1220
+ iconOnly
1221
+ variant="text"
1222
+ rounded
1223
+ severity="secondary"
1224
+ size="small"
1225
+ >
1226
+ <ChevronDown />
1227
+ </DatePicker.Decrement>
1228
+ </DatePicker.Picker>
1229
+ </DatePicker.Time>
1230
+ </DatePicker.Panel>
1231
+ </DatePicker.Body>
1232
+ </DatePicker.Popup>
1233
+ </DatePicker.Positioner>
1234
+ </DatePicker.Portal>
1235
+ </DatePicker.Root>
1236
+ </div>
1237
+ <div className="flex-auto">
1238
+ <Label htmlFor="datepicker-timeonly" className="text-sm font-bold block mb-2">
1239
+ Time Only
1240
+ </Label>
1241
+ <DatePicker.Root value={date3} timeOnly fluid onValueChange={(event: DatePickerRootValueChangeEvent) => setDate3(event.value)}>
1242
+ <DatePicker.Input as={InputText} id="datepicker-timeonly" fluid />
1243
+ <DatePicker.Portal>
1244
+ <DatePicker.Positioner>
1245
+ <DatePicker.Popup>
1246
+ <DatePicker.Body>
1247
+ <DatePicker.Panel>
1248
+ <DatePicker.Time>
1249
+ <DatePicker.Picker type="hour">
1250
+ <DatePicker.Increment
1251
+ as={Button}
1252
+ iconOnly
1253
+ variant="text"
1254
+ rounded
1255
+ severity="secondary"
1256
+ size="small"
1257
+ >
1258
+ <ChevronUp />
1259
+ </DatePicker.Increment>
1260
+ <DatePicker.Hour />
1261
+ <DatePicker.Decrement
1262
+ as={Button}
1263
+ iconOnly
1264
+ variant="text"
1265
+ rounded
1266
+ severity="secondary"
1267
+ size="small"
1268
+ >
1269
+ <ChevronDown />
1270
+ </DatePicker.Decrement>
1271
+ </DatePicker.Picker>
1272
+ <DatePicker.Separator />
1273
+ <DatePicker.Picker type="minute">
1274
+ <DatePicker.Increment
1275
+ as={Button}
1276
+ iconOnly
1277
+ variant="text"
1278
+ rounded
1279
+ severity="secondary"
1280
+ size="small"
1281
+ >
1282
+ <ChevronUp />
1283
+ </DatePicker.Increment>
1284
+ <DatePicker.Minute />
1285
+ <DatePicker.Decrement
1286
+ as={Button}
1287
+ iconOnly
1288
+ variant="text"
1289
+ rounded
1290
+ severity="secondary"
1291
+ size="small"
1292
+ >
1293
+ <ChevronDown />
1294
+ </DatePicker.Decrement>
1295
+ </DatePicker.Picker>
1296
+ </DatePicker.Time>
1297
+ </DatePicker.Panel>
1298
+ </DatePicker.Body>
1299
+ </DatePicker.Popup>
1300
+ </DatePicker.Positioner>
1301
+ </DatePicker.Portal>
1302
+ </DatePicker.Root>
1303
+ </div>
1304
+ </div>
1305
+ </>
1306
+ );
1307
+ }
1308
+ ```
1309
+
1310
+ ### Month Picker
1311
+
1312
+ Month only picker is enabled by specifying `view` as `month` in addition to a suitable `dateFormat`.
1313
+
1314
+ ```tsx
1315
+ 'use client';
1316
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
1317
+ import { ChevronRight } from '@primeicons/react/chevron-right';
1318
+ import { Button } from '@primereact/ui/button';
1319
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
1320
+
1321
+ import { InputText } from '@primereact/ui/inputtext';
1322
+ import * as React from 'react';
1323
+
1324
+ export default function MonthPickerDemo() {
1325
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
1326
+
1327
+ return (
1328
+ <div className="flex justify-center">
1329
+ <DatePicker.Root
1330
+ value={date}
1331
+ view="month"
1332
+ dateFormat="mm/yy"
1333
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}
1334
+ >
1335
+ <DatePicker.Input as={InputText} />
1336
+ <DatePicker.Portal>
1337
+ <DatePicker.Positioner>
1338
+ <DatePicker.Popup>
1339
+ <DatePicker.Body>
1340
+ <DatePicker.Panel>
1341
+ <DatePicker.Calendar>
1342
+ <DatePicker.Header>
1343
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1344
+ <ChevronLeft />
1345
+ </DatePicker.Prev>
1346
+ <DatePicker.Title>
1347
+ <DatePicker.SelectMonth />
1348
+ <DatePicker.SelectYear />
1349
+ <DatePicker.Decade />
1350
+ </DatePicker.Title>
1351
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1352
+ <ChevronRight />
1353
+ </DatePicker.Next>
1354
+ </DatePicker.Header>
1355
+ <DatePicker.Table>
1356
+ <DatePicker.TableHead />
1357
+ <DatePicker.TableBody view="month" />
1358
+ <DatePicker.TableBody view="year" />
1359
+ </DatePicker.Table>
1360
+ </DatePicker.Calendar>
1361
+ </DatePicker.Panel>
1362
+ </DatePicker.Body>
1363
+ </DatePicker.Popup>
1364
+ </DatePicker.Positioner>
1365
+ </DatePicker.Portal>
1366
+ </DatePicker.Root>
1367
+ </div>
1368
+ );
1369
+ }
1370
+ ```
1371
+
1372
+ ### Year Picker
1373
+
1374
+ Year only picker is enabled by specifying `view` as `year` in addition to a suitable `dateFormat`.
1375
+
1376
+ ```tsx
1377
+ 'use client';
1378
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
1379
+ import { ChevronRight } from '@primeicons/react/chevron-right';
1380
+ import { Button } from '@primereact/ui/button';
1381
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
1382
+
1383
+ import { InputText } from '@primereact/ui/inputtext';
1384
+ import * as React from 'react';
1385
+
1386
+ export default function YearPickerDemo() {
1387
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
1388
+
1389
+ return (
1390
+ <div className="flex justify-center">
1391
+ <DatePicker.Root value={date} view="year" dateFormat="yy" onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
1392
+ <DatePicker.Input as={InputText} />
1393
+ <DatePicker.Portal>
1394
+ <DatePicker.Positioner>
1395
+ <DatePicker.Popup>
1396
+ <DatePicker.Body>
1397
+ <DatePicker.Panel>
1398
+ <DatePicker.Calendar>
1399
+ <DatePicker.Header>
1400
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1401
+ <ChevronLeft />
1402
+ </DatePicker.Prev>
1403
+ <DatePicker.Title>
1404
+ <DatePicker.SelectMonth />
1405
+ <DatePicker.SelectYear />
1406
+ <DatePicker.Decade />
1407
+ </DatePicker.Title>
1408
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1409
+ <ChevronRight />
1410
+ </DatePicker.Next>
1411
+ </DatePicker.Header>
1412
+ <DatePicker.Table>
1413
+ <DatePicker.TableHead />
1414
+ <DatePicker.TableBody view="year" />
1415
+ </DatePicker.Table>
1416
+ </DatePicker.Calendar>
1417
+ </DatePicker.Panel>
1418
+ </DatePicker.Body>
1419
+ </DatePicker.Popup>
1420
+ </DatePicker.Positioner>
1421
+ </DatePicker.Portal>
1422
+ </DatePicker.Root>
1423
+ </div>
1424
+ );
1425
+ }
1426
+ ```
1427
+
1428
+ ### Multiple Months
1429
+
1430
+ Number of months to display is configured with the `numberOfMonths` property.
1431
+
1432
+ ```tsx
1433
+ 'use client';
1434
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
1435
+ import { ChevronRight } from '@primeicons/react/chevron-right';
1436
+ import { Button } from '@primereact/ui/button';
1437
+ import {
1438
+ DatePicker,
1439
+ type DatePickerBodyInstance,
1440
+ type DatePickerMonthData,
1441
+ type DatePickerRootProps,
1442
+ type DatePickerRootValueChangeEvent
1443
+ } from '@primereact/ui/datepicker';
1444
+ import { InputText } from '@primereact/ui/inputtext';
1445
+ import * as React from 'react';
1446
+
1447
+ export default function MultipleMonthsDemo() {
1448
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
1449
+
1450
+ return (
1451
+ <div className="flex justify-center">
1452
+ <DatePicker.Root value={date} numberOfMonths={2} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
1453
+ <DatePicker.Input as={InputText} />
1454
+ <DatePicker.Portal>
1455
+ <DatePicker.Positioner align="center" sideOffset={12}>
1456
+ <DatePicker.Popup>
1457
+ <DatePicker.Body className="flex gap-4">
1458
+ {(instance: DatePickerBodyInstance) => {
1459
+ const { datepicker } = instance;
1460
+ const months = datepicker?.months as DatePickerMonthData[];
1461
+
1462
+ return months?.map((_, groupIndex) => {
1463
+ const month = datepicker?.getIndexedMonth?.(groupIndex) as DatePickerMonthData;
1464
+
1465
+ return (
1466
+ <DatePicker.Panel key={groupIndex}>
1467
+ <DatePicker.Calendar>
1468
+ {groupIndex === 0 && (
1469
+ <>
1470
+ <DatePicker.Header>
1471
+ <DatePicker.Prev
1472
+ as={Button}
1473
+ iconOnly
1474
+ variant="text"
1475
+ rounded
1476
+ severity="secondary"
1477
+ size="small"
1478
+ >
1479
+ <ChevronLeft />
1480
+ </DatePicker.Prev>
1481
+ <DatePicker.Title>
1482
+ <DatePicker.SelectMonth>
1483
+ {datepicker?.getMonthName?.(month.month)}
1484
+ </DatePicker.SelectMonth>
1485
+ <DatePicker.SelectYear>{month.year}</DatePicker.SelectYear>
1486
+ <DatePicker.Decade />
1487
+ </DatePicker.Title>
1488
+ </DatePicker.Header>
1489
+ </>
1490
+ )}
1491
+ {groupIndex === 1 && (
1492
+ <>
1493
+ <DatePicker.Header>
1494
+ <DatePicker.Title>
1495
+ <DatePicker.SelectMonth>
1496
+ {datepicker?.getMonthName?.(month.month)}
1497
+ </DatePicker.SelectMonth>
1498
+ <DatePicker.SelectYear>{month.year}</DatePicker.SelectYear>
1499
+ <DatePicker.Decade />
1500
+ </DatePicker.Title>
1501
+ <DatePicker.Next
1502
+ as={Button}
1503
+ iconOnly
1504
+ variant="text"
1505
+ rounded
1506
+ severity="secondary"
1507
+ size="small"
1508
+ >
1509
+ <ChevronRight />
1510
+ </DatePicker.Next>
1511
+ </DatePicker.Header>
1512
+ </>
1513
+ )}
1514
+ <DatePicker.Table>
1515
+ <DatePicker.TableHead />
1516
+ <DatePicker.TableBody index={groupIndex} />
1517
+ <DatePicker.TableBody view="month" />
1518
+ <DatePicker.TableBody view="year" />
1519
+ </DatePicker.Table>
1520
+ </DatePicker.Calendar>
1521
+ </DatePicker.Panel>
1522
+ );
1523
+ });
1524
+ }}
1525
+ </DatePicker.Body>
1526
+ </DatePicker.Popup>
1527
+ </DatePicker.Positioner>
1528
+ </DatePicker.Portal>
1529
+ </DatePicker.Root>
1530
+ </div>
1531
+ );
1532
+ }
1533
+ ```
1534
+
1535
+ ### Model Type
1536
+
1537
+ The `updateModelType` property controls the data type of the value. When set to `string` it returns a string representation of the date, when set to `date` (default) it returns a Date object.
1538
+
1539
+ ```tsx
1540
+ 'use client';
1541
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
1542
+ import { ChevronRight } from '@primeicons/react/chevron-right';
1543
+ import { Button } from '@primereact/ui/button';
1544
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
1545
+ import { InputText } from '@primereact/ui/inputtext';
1546
+ import { Label } from '@primereact/ui/label';
1547
+ import * as React from 'react';
1548
+
1549
+ export default function ModelTypeDemo() {
1550
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
1551
+ const [date2, setDate2] = React.useState<DatePickerRootProps['value'] | null>(null);
1552
+
1553
+ return (
1554
+ <div className="flex flex-wrap gap-4">
1555
+ <div className="flex-auto">
1556
+ <Label htmlFor="datetype" className="text-sm font-bold block mb-2">
1557
+ Date Type Model
1558
+ </Label>
1559
+ <DatePicker.Root value={date} fluid onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
1560
+ <DatePicker.Input as={InputText} id="datetype" fluid />
1561
+ <DatePicker.Portal>
1562
+ <DatePicker.Positioner>
1563
+ <DatePicker.Popup>
1564
+ <DatePicker.Body>
1565
+ <DatePicker.Panel>
1566
+ <DatePicker.Calendar>
1567
+ <DatePicker.Header>
1568
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1569
+ <ChevronLeft />
1570
+ </DatePicker.Prev>
1571
+ <DatePicker.Title>
1572
+ <DatePicker.SelectMonth />
1573
+ <DatePicker.SelectYear />
1574
+ <DatePicker.Decade />
1575
+ </DatePicker.Title>
1576
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1577
+ <ChevronRight />
1578
+ </DatePicker.Next>
1579
+ </DatePicker.Header>
1580
+ <DatePicker.Table>
1581
+ <DatePicker.TableHead />
1582
+ <DatePicker.TableBody />
1583
+ <DatePicker.TableBody view="month" />
1584
+ <DatePicker.TableBody view="year" />
1585
+ </DatePicker.Table>
1586
+ </DatePicker.Calendar>
1587
+ </DatePicker.Panel>
1588
+ </DatePicker.Body>
1589
+ </DatePicker.Popup>
1590
+ </DatePicker.Positioner>
1591
+ </DatePicker.Portal>
1592
+ </DatePicker.Root>
1593
+ </div>
1594
+ <div className="flex-auto">
1595
+ <Label htmlFor="stringtype" className="text-sm font-bold block mb-2">
1596
+ String Type Model
1597
+ </Label>
1598
+ <DatePicker.Root
1599
+ value={date2}
1600
+ updateModelType="string"
1601
+ fluid
1602
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setDate2(event.value)}
1603
+ >
1604
+ <DatePicker.Input as={InputText} id="stringtype" fluid />
1605
+ <DatePicker.Portal>
1606
+ <DatePicker.Positioner>
1607
+ <DatePicker.Popup>
1608
+ <DatePicker.Body>
1609
+ <DatePicker.Panel>
1610
+ <DatePicker.Calendar>
1611
+ <DatePicker.Header>
1612
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1613
+ <ChevronLeft />
1614
+ </DatePicker.Prev>
1615
+ <DatePicker.Title>
1616
+ <DatePicker.SelectMonth />
1617
+ <DatePicker.SelectYear />
1618
+ <DatePicker.Decade />
1619
+ </DatePicker.Title>
1620
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1621
+ <ChevronRight />
1622
+ </DatePicker.Next>
1623
+ </DatePicker.Header>
1624
+ <DatePicker.Table>
1625
+ <DatePicker.TableHead />
1626
+ <DatePicker.TableBody />
1627
+ <DatePicker.TableBody view="month" />
1628
+ <DatePicker.TableBody view="year" />
1629
+ </DatePicker.Table>
1630
+ </DatePicker.Calendar>
1631
+ </DatePicker.Panel>
1632
+ </DatePicker.Body>
1633
+ </DatePicker.Popup>
1634
+ </DatePicker.Positioner>
1635
+ </DatePicker.Portal>
1636
+ </DatePicker.Root>
1637
+ </div>
1638
+ </div>
1639
+ );
1640
+ }
1641
+ ```
1642
+
1643
+ ### Date Template
1644
+
1645
+ Custom content can be placed inside date cells with the `DatePicker.TableHeadCell` component that takes a Date as a parameter.
1646
+
1647
+ ```tsx
1648
+ 'use client';
1649
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
1650
+ import { ChevronRight } from '@primeicons/react/chevron-right';
1651
+ import { Button } from '@primereact/ui/button';
1652
+ import {
1653
+ DatePicker,
1654
+ type DatePickerDateMeta,
1655
+ type DatePickerMonthData,
1656
+ type DatePickerRootValueChangeEvent,
1657
+ type DatePickerTableBodyInstance
1658
+ } from '@primereact/ui/datepicker';
1659
+ import { InputText } from '@primereact/ui/inputtext';
1660
+ import * as React from 'react';
1661
+
1662
+ export default function DateTemplateDemo() {
1663
+ const [date, setDate] = React.useState<Date | null>(null);
1664
+
1665
+ return (
1666
+ <div className="flex justify-center">
1667
+ <DatePicker.Root value={date} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value as Date)}>
1668
+ <DatePicker.Input as={InputText} />
1669
+ <DatePicker.Portal>
1670
+ <DatePicker.Positioner>
1671
+ <DatePicker.Popup>
1672
+ <DatePicker.Body>
1673
+ <DatePicker.Panel>
1674
+ <DatePicker.Calendar>
1675
+ <DatePicker.Header>
1676
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1677
+ <ChevronLeft />
1678
+ </DatePicker.Prev>
1679
+ <DatePicker.Title>
1680
+ <DatePicker.SelectMonth />
1681
+ <DatePicker.SelectYear />
1682
+ <DatePicker.Decade />
1683
+ </DatePicker.Title>
1684
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1685
+ <ChevronRight />
1686
+ </DatePicker.Next>
1687
+ </DatePicker.Header>
1688
+ <DatePicker.Table>
1689
+ <DatePicker.TableHead />
1690
+ <DatePicker.TableBody>
1691
+ {(instance: DatePickerTableBodyInstance) => {
1692
+ const { datepicker } = instance;
1693
+ const month = datepicker?.getIndexedMonth?.() as DatePickerMonthData;
1694
+
1695
+ return (
1696
+ <>
1697
+ {month.dates?.map((week) => (
1698
+ <DatePicker.TableBodyRow key={week[0].day + '' + week[0].month}>
1699
+ <>
1700
+ {week.map((d) => {
1701
+ const events = getEventsForDate(d.day, d.month);
1702
+ const weekend = isWeekend(d);
1703
+ const selected = date && datepicker?.isDateEquals(date, d);
1704
+
1705
+ return (
1706
+ <DatePicker.TableBodyCell
1707
+ key={d.day + '' + d.month}
1708
+ date={d}
1709
+ className="p-0.5"
1710
+ >
1711
+ <DatePicker.Day day={d} className="w-10 h-10 rounded-full">
1712
+ <div className="flex flex-col items-center leading-none gap-0.5">
1713
+ <span
1714
+ className={`text-sm ${
1715
+ d.otherMonth
1716
+ ? 'text-surface-400 dark:text-surface-600'
1717
+ : weekend && !selected
1718
+ ? 'text-red-500 dark:text-red-400'
1719
+ : ''
1720
+ }`}
1721
+ >
1722
+ {d.day}
1723
+ </span>
1724
+ {events.length > 0 && !d.otherMonth && (
1725
+ <div className="flex gap-0.5">
1726
+ {events.slice(0, 3).map((event, i) => (
1727
+ <span
1728
+ key={i}
1729
+ title={event.label}
1730
+ className={`w-1 h-1 rounded-full ${selected ? DOT_COLORS[event.type].selected : DOT_COLORS[event.type].normal}`}
1731
+ />
1732
+ ))}
1733
+ </div>
1734
+ )}
1735
+ </div>
1736
+ </DatePicker.Day>
1737
+ </DatePicker.TableBodyCell>
1738
+ );
1739
+ })}
1740
+ </>
1741
+ </DatePicker.TableBodyRow>
1742
+ ))}
1743
+ </>
1744
+ );
1745
+ }}
1746
+ </DatePicker.TableBody>
1747
+ <DatePicker.TableBody view="month" />
1748
+ <DatePicker.TableBody view="year" />
1749
+ </DatePicker.Table>
1750
+ </DatePicker.Calendar>
1751
+ </DatePicker.Panel>
1752
+ </DatePicker.Body>
1753
+ </DatePicker.Popup>
1754
+ </DatePicker.Positioner>
1755
+ </DatePicker.Portal>
1756
+ </DatePicker.Root>
1757
+ </div>
1758
+ );
1759
+ }
1760
+
1761
+ type EventType = 'personal' | 'work' | 'holiday';
1762
+
1763
+ interface CalendarEvent {
1764
+ label: string;
1765
+ type: EventType;
1766
+ }
1767
+
1768
+ const DOT_COLORS: Record<EventType, { normal: string; selected: string }> = {
1769
+ personal: {
1770
+ normal: 'bg-blue-500 dark:bg-blue-400',
1771
+ selected: 'bg-blue-200 dark:bg-blue-300'
1772
+ },
1773
+ work: {
1774
+ normal: 'bg-orange-500 dark:bg-orange-400',
1775
+ selected: 'bg-orange-200 dark:bg-orange-300'
1776
+ },
1777
+ holiday: {
1778
+ normal: 'bg-teal-500 dark:bg-teal-400',
1779
+ selected: 'bg-teal-200 dark:bg-teal-300'
1780
+ }
1781
+ };
1782
+
1783
+ function getEventsForDate(day: number, month: number): CalendarEvent[] {
1784
+ const events: CalendarEvent[] = [];
1785
+ const d = new Date(2025, month, day);
1786
+ const dayOfWeek = d.getDay();
1787
+
1788
+ // Work meetings on weekdays: Mon, Wed, Fri
1789
+ if (dayOfWeek === 1 || dayOfWeek === 3 || dayOfWeek === 5) {
1790
+ events.push({ label: 'Standup', type: 'work' });
1791
+ }
1792
+
1793
+ // Personal events
1794
+ if (day === 5 || day === 14 || day === 22) {
1795
+ events.push({ label: 'Gym', type: 'personal' });
1796
+ }
1797
+
1798
+ // Holidays
1799
+ if (
1800
+ (month === 0 && day === 1) ||
1801
+ (month === 1 && day === 14) ||
1802
+ (month === 4 && day === 1) ||
1803
+ (month === 11 && day === 25) ||
1804
+ (month === 11 && day === 31)
1805
+ ) {
1806
+ events.push({ label: 'Holiday', type: 'holiday' });
1807
+ }
1808
+
1809
+ // Sprint reviews (every other Thursday)
1810
+ if (dayOfWeek === 4 && (day <= 7 || (day > 14 && day <= 21))) {
1811
+ events.push({ label: 'Sprint Review', type: 'work' });
1812
+ }
1813
+
1814
+ // Unique types only
1815
+ const seen = new Set<EventType>();
1816
+
1817
+ return events.filter((e) => {
1818
+ if (seen.has(e.type)) return false;
1819
+
1820
+ seen.add(e.type);
1821
+
1822
+ return true;
1823
+ });
1824
+ }
1825
+
1826
+ function isWeekend(date: DatePickerDateMeta): boolean {
1827
+ const d = new Date(date.year, date.month, date.day);
1828
+
1829
+ return d.getDay() === 0 || d.getDay() === 6;
1830
+ }
1831
+ ```
1832
+
1833
+ ### Arrow
1834
+
1835
+ Use `DatePicker.Arrow` inside the popup to display an arrow pointing to the trigger element. Set `sideOffset` on `DatePicker.Positioner` for spacing.
1836
+
1837
+ ```tsx
1838
+ 'use client';
1839
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
1840
+ import { ChevronRight } from '@primeicons/react/chevron-right';
1841
+ import { Button } from '@primereact/ui/button';
1842
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
1843
+ import { InputText } from '@primereact/ui/inputtext';
1844
+ import * as React from 'react';
1845
+
1846
+ export default function ArrowDemo() {
1847
+ const [date, setDate] = React.useState<DatePickerRootProps['value']>(null);
1848
+
1849
+ return (
1850
+ <div className="flex justify-center">
1851
+ <DatePicker.Root value={date} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)} className="w-full md:w-56">
1852
+ <DatePicker.Input as={InputText} className="w-full" />
1853
+ <DatePicker.Portal>
1854
+ <DatePicker.Positioner sideOffset={12}>
1855
+ <DatePicker.Popup>
1856
+ <DatePicker.Arrow />
1857
+ <DatePicker.Body>
1858
+ <DatePicker.Panel>
1859
+ <DatePicker.Calendar>
1860
+ <DatePicker.Header>
1861
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1862
+ <ChevronLeft />
1863
+ </DatePicker.Prev>
1864
+ <DatePicker.Title>
1865
+ <DatePicker.SelectMonth />
1866
+ <DatePicker.SelectYear />
1867
+ <DatePicker.Decade />
1868
+ </DatePicker.Title>
1869
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1870
+ <ChevronRight />
1871
+ </DatePicker.Next>
1872
+ </DatePicker.Header>
1873
+ <DatePicker.Table>
1874
+ <DatePicker.TableHead />
1875
+ <DatePicker.TableBody />
1876
+ <DatePicker.TableBody view="month" />
1877
+ <DatePicker.TableBody view="year" />
1878
+ </DatePicker.Table>
1879
+ </DatePicker.Calendar>
1880
+ </DatePicker.Panel>
1881
+ </DatePicker.Body>
1882
+ </DatePicker.Popup>
1883
+ </DatePicker.Positioner>
1884
+ </DatePicker.Portal>
1885
+ </DatePicker.Root>
1886
+ </div>
1887
+ );
1888
+ }
1889
+ ```
1890
+
1891
+ ### Inline
1892
+
1893
+ ```tsx
1894
+ 'use client';
1895
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
1896
+ import { ChevronRight } from '@primeicons/react/chevron-right';
1897
+ import { Button } from '@primereact/ui/button';
1898
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
1899
+
1900
+ import * as React from 'react';
1901
+
1902
+ export default function InlineDemo() {
1903
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
1904
+
1905
+ return (
1906
+ <div className="flex justify-center">
1907
+ <DatePicker.Root value={date} showWeek onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
1908
+ <DatePicker.Body>
1909
+ <DatePicker.Panel>
1910
+ <DatePicker.Calendar>
1911
+ <DatePicker.Header className="bg-transparent!">
1912
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1913
+ <ChevronLeft />
1914
+ </DatePicker.Prev>
1915
+ <DatePicker.Title>
1916
+ <DatePicker.SelectMonth />
1917
+ <DatePicker.SelectYear />
1918
+ <DatePicker.Decade />
1919
+ </DatePicker.Title>
1920
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
1921
+ <ChevronRight />
1922
+ </DatePicker.Next>
1923
+ </DatePicker.Header>
1924
+ <DatePicker.Table>
1925
+ <DatePicker.TableHead />
1926
+ <DatePicker.TableBody />
1927
+ <DatePicker.TableBody view="month" />
1928
+ <DatePicker.TableBody view="year" />
1929
+ </DatePicker.Table>
1930
+ </DatePicker.Calendar>
1931
+ </DatePicker.Panel>
1932
+ </DatePicker.Body>
1933
+ </DatePicker.Root>
1934
+ </div>
1935
+ );
1936
+ }
1937
+ ```
1938
+
1939
+ ### Inline Template
1940
+
1941
+ Custom content can be placed inside date cells in inline mode with the `DatePicker.TableHeadCell` component that takes a Date as a parameter.
1942
+
1943
+ ```tsx
1944
+ 'use client';
1945
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
1946
+ import { ChevronRight } from '@primeicons/react/chevron-right';
1947
+ import { Button } from '@primereact/ui/button';
1948
+ import {
1949
+ DatePicker,
1950
+ type DatePickerBodyInstance,
1951
+ type DatePickerMonthData,
1952
+ type DatePickerRootValueChangeEvent,
1953
+ type DatePickerTableBodyInstance
1954
+ } from '@primereact/ui/datepicker';
1955
+ import * as React from 'react';
1956
+
1957
+ const getRandomNumber = (min: number = 30, max: number = 100): number => {
1958
+ return Math.floor(Math.random() * (max - min + 1)) + min;
1959
+ };
1960
+
1961
+ export default function InlineTemplateDemo() {
1962
+ const [value, setValue] = React.useState<Date | null>(null);
1963
+ const priceMapRef = React.useRef(new Map<string, number>());
1964
+
1965
+ const getPrice = React.useCallback((year: number, month: number, day: number) => {
1966
+ const key = `${year}-${month}-${day}`;
1967
+
1968
+ if (!priceMapRef.current.has(key)) {
1969
+ priceMapRef.current.set(key, getRandomNumber());
1970
+ }
1971
+
1972
+ return priceMapRef.current.get(key)!;
1973
+ }, []);
1974
+
1975
+ return (
1976
+ <div className="flex justify-center">
1977
+ <DatePicker.Root
1978
+ value={value}
1979
+ numberOfMonths={2}
1980
+ onValueChange={(event: DatePickerRootValueChangeEvent) => setValue(event.value as Date)}
1981
+ >
1982
+ <DatePicker.Body className="flex gap-4">
1983
+ {(instance: DatePickerBodyInstance) => {
1984
+ const { datepicker } = instance;
1985
+ const months = datepicker?.months as DatePickerMonthData[];
1986
+
1987
+ return (
1988
+ <>
1989
+ {months?.map((month, groupIndex) => {
1990
+ return (
1991
+ <DatePicker.Panel key={groupIndex}>
1992
+ <DatePicker.Calendar>
1993
+ {groupIndex === 0 && (
1994
+ <>
1995
+ <DatePicker.Header className="bg-transparent!">
1996
+ <DatePicker.Prev
1997
+ as={Button}
1998
+ iconOnly
1999
+ variant="text"
2000
+ rounded
2001
+ severity="secondary"
2002
+ size="small"
2003
+ >
2004
+ <ChevronLeft />
2005
+ </DatePicker.Prev>
2006
+ <DatePicker.Title>
2007
+ <DatePicker.SelectMonth>
2008
+ {datepicker?.getMonthName?.(month.month)}
2009
+ </DatePicker.SelectMonth>
2010
+ <DatePicker.SelectYear>{month.year}</DatePicker.SelectYear>
2011
+ <DatePicker.Decade />
2012
+ </DatePicker.Title>
2013
+ </DatePicker.Header>
2014
+ </>
2015
+ )}
2016
+ {groupIndex === 1 && (
2017
+ <>
2018
+ <DatePicker.Header className="bg-transparent!">
2019
+ <DatePicker.Title>
2020
+ <DatePicker.SelectMonth>
2021
+ {datepicker?.getMonthName?.(month.month)}
2022
+ </DatePicker.SelectMonth>
2023
+ <DatePicker.SelectYear>{month.year}</DatePicker.SelectYear>
2024
+ <DatePicker.Decade />
2025
+ </DatePicker.Title>
2026
+ <DatePicker.Next
2027
+ as={Button}
2028
+ iconOnly
2029
+ variant="text"
2030
+ rounded
2031
+ severity="secondary"
2032
+ size="small"
2033
+ >
2034
+ <ChevronRight />
2035
+ </DatePicker.Next>
2036
+ </DatePicker.Header>
2037
+ </>
2038
+ )}
2039
+ <DatePicker.Table>
2040
+ <DatePicker.TableHead />
2041
+ <DatePicker.TableBody>
2042
+ {(instance: DatePickerTableBodyInstance) => {
2043
+ const { datepicker } = instance;
2044
+ const month = datepicker?.getIndexedMonth?.(groupIndex) as DatePickerMonthData;
2045
+
2046
+ return (
2047
+ <>
2048
+ {month.dates?.map((week) => (
2049
+ <DatePicker.TableBodyRow key={week[0].day + '' + week[0].month}>
2050
+ <>
2051
+ {week.map((date) => {
2052
+ const today = new Date();
2053
+
2054
+ today.setHours(0, 0, 0, 0);
2055
+ const currentDate = new Date(date.year, date.month, date.day);
2056
+ const price =
2057
+ currentDate >= today
2058
+ ? getPrice(date.year, date.month, date.day)
2059
+ : null;
2060
+ const isLowPrice = price !== null && price < 50;
2061
+ const selected = datepicker?.isSelected(date);
2062
+
2063
+ return (
2064
+ <DatePicker.TableBodyCell
2065
+ key={date.day + '' + date.month}
2066
+ date={date}
2067
+ className={`p-2! ${date.otherMonth ? 'invisible' : ''}`}
2068
+ >
2069
+ <DatePicker.Day
2070
+ day={date}
2071
+ className="w-12! h-12! rounded-lg!"
2072
+ >
2073
+ <div
2074
+ className={`flex flex-col items-center gap-1 min-w-[50px]`}
2075
+ >
2076
+ <span className="font-semibold text-base">
2077
+ {date.day}
2078
+ </span>
2079
+ {price !== null && (
2080
+ <span
2081
+ className={`text-sm font-medium ${
2082
+ selected
2083
+ ? isLowPrice
2084
+ ? 'text-green-200 dark:text-green-900'
2085
+ : 'opacity-70'
2086
+ : isLowPrice
2087
+ ? 'text-green-600 dark:text-green-400'
2088
+ : 'text-surface-600 dark:text-surface-400'
2089
+ }`}
2090
+ >
2091
+ ${price}
2092
+ </span>
2093
+ )}
2094
+ </div>
2095
+ </DatePicker.Day>
2096
+ </DatePicker.TableBodyCell>
2097
+ );
2098
+ })}
2099
+ </>
2100
+ </DatePicker.TableBodyRow>
2101
+ ))}
2102
+ </>
2103
+ );
2104
+ }}
2105
+ </DatePicker.TableBody>
2106
+ </DatePicker.Table>
2107
+ </DatePicker.Calendar>
2108
+ </DatePicker.Panel>
2109
+ );
2110
+ })}
2111
+ </>
2112
+ );
2113
+ }}
2114
+ </DatePicker.Body>
2115
+ </DatePicker.Root>
2116
+ </div>
2117
+ );
2118
+ }
2119
+ ```
2120
+
2121
+ ### Float Label
2122
+
2123
+ FloatLabel visually integrates a label with its form element. Visit [FloatLabel](/docs/components/floatlabel) documentation for more information.
2124
+
2125
+ ```tsx
2126
+ 'use client';
2127
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
2128
+ import { ChevronRight } from '@primeicons/react/chevron-right';
2129
+ import { Button } from '@primereact/ui/button';
2130
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
2131
+ import { FloatLabel } from '@primereact/ui/floatlabel';
2132
+ import { InputText } from '@primereact/ui/inputtext';
2133
+ import { Label } from '@primereact/ui/label';
2134
+ import * as React from 'react';
2135
+
2136
+ export default function FloatLabelDemo() {
2137
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
2138
+ const [date2, setDate2] = React.useState<DatePickerRootProps['value'] | null>(null);
2139
+ const [date3, setDate3] = React.useState<DatePickerRootProps['value'] | null>(null);
2140
+
2141
+ return (
2142
+ <div className="flex flex-wrap justify-center items-end gap-4">
2143
+ <FloatLabel>
2144
+ <DatePicker.Root value={date} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
2145
+ <DatePicker.Input as={InputText} id="over_label" />
2146
+ <DatePicker.Portal>
2147
+ <DatePicker.Positioner>
2148
+ <DatePicker.Popup>
2149
+ <DatePicker.Body>
2150
+ <DatePicker.Panel>
2151
+ <DatePicker.Calendar>
2152
+ <DatePicker.Header>
2153
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2154
+ <ChevronLeft />
2155
+ </DatePicker.Prev>
2156
+ <DatePicker.Title>
2157
+ <DatePicker.SelectMonth />
2158
+ <DatePicker.SelectYear />
2159
+ <DatePicker.Decade />
2160
+ </DatePicker.Title>
2161
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2162
+ <ChevronRight />
2163
+ </DatePicker.Next>
2164
+ </DatePicker.Header>
2165
+ <DatePicker.Table>
2166
+ <DatePicker.TableHead />
2167
+ <DatePicker.TableBody />
2168
+ <DatePicker.TableBody view="month" />
2169
+ <DatePicker.TableBody view="year" />
2170
+ </DatePicker.Table>
2171
+ </DatePicker.Calendar>
2172
+ </DatePicker.Panel>
2173
+ </DatePicker.Body>
2174
+ </DatePicker.Popup>
2175
+ </DatePicker.Positioner>
2176
+ </DatePicker.Portal>
2177
+ </DatePicker.Root>
2178
+ <Label htmlFor="over_label">Over Label</Label>
2179
+ </FloatLabel>
2180
+
2181
+ <FloatLabel variant="in">
2182
+ <DatePicker.Root value={date2} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate2(event.value)}>
2183
+ <DatePicker.Input as={InputText} id="in_label" />
2184
+ <DatePicker.Portal>
2185
+ <DatePicker.Positioner>
2186
+ <DatePicker.Popup>
2187
+ <DatePicker.Body>
2188
+ <DatePicker.Panel>
2189
+ <DatePicker.Calendar>
2190
+ <DatePicker.Header>
2191
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2192
+ <ChevronLeft />
2193
+ </DatePicker.Prev>
2194
+ <DatePicker.Title>
2195
+ <DatePicker.SelectMonth />
2196
+ <DatePicker.SelectYear />
2197
+ <DatePicker.Decade />
2198
+ </DatePicker.Title>
2199
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2200
+ <ChevronRight />
2201
+ </DatePicker.Next>
2202
+ </DatePicker.Header>
2203
+ <DatePicker.Table>
2204
+ <DatePicker.TableHead />
2205
+ <DatePicker.TableBody />
2206
+ <DatePicker.TableBody view="month" />
2207
+ <DatePicker.TableBody view="year" />
2208
+ </DatePicker.Table>
2209
+ </DatePicker.Calendar>
2210
+ </DatePicker.Panel>
2211
+ </DatePicker.Body>
2212
+ </DatePicker.Popup>
2213
+ </DatePicker.Positioner>
2214
+ </DatePicker.Portal>
2215
+ </DatePicker.Root>
2216
+ <Label htmlFor="in_label">In Label</Label>
2217
+ </FloatLabel>
2218
+
2219
+ <FloatLabel variant="on">
2220
+ <DatePicker.Root value={date3} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate3(event.value)}>
2221
+ <DatePicker.Input as={InputText} id="on_label" />
2222
+ <DatePicker.Portal>
2223
+ <DatePicker.Positioner>
2224
+ <DatePicker.Popup>
2225
+ <DatePicker.Body>
2226
+ <DatePicker.Panel>
2227
+ <DatePicker.Calendar>
2228
+ <DatePicker.Header>
2229
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2230
+ <ChevronLeft />
2231
+ </DatePicker.Prev>
2232
+ <DatePicker.Title>
2233
+ <DatePicker.SelectMonth />
2234
+ <DatePicker.SelectYear />
2235
+ <DatePicker.Decade />
2236
+ </DatePicker.Title>
2237
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2238
+ <ChevronRight />
2239
+ </DatePicker.Next>
2240
+ </DatePicker.Header>
2241
+ <DatePicker.Table>
2242
+ <DatePicker.TableHead />
2243
+ <DatePicker.TableBody />
2244
+ <DatePicker.TableBody view="month" />
2245
+ <DatePicker.TableBody view="year" />
2246
+ </DatePicker.Table>
2247
+ </DatePicker.Calendar>
2248
+ </DatePicker.Panel>
2249
+ </DatePicker.Body>
2250
+ </DatePicker.Popup>
2251
+ </DatePicker.Positioner>
2252
+ </DatePicker.Portal>
2253
+ </DatePicker.Root>
2254
+ <Label htmlFor="on_label">On Label</Label>
2255
+ </FloatLabel>
2256
+ </div>
2257
+ );
2258
+ }
2259
+ ```
2260
+
2261
+ ### Ifta Label
2262
+
2263
+ IftaLabel is used to create infield top aligned labels. Visit [IftaLabel](/docs/components/iftalabel) documentation for more information.
2264
+
2265
+ ```tsx
2266
+ 'use client';
2267
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
2268
+ import { ChevronRight } from '@primeicons/react/chevron-right';
2269
+ import { Button } from '@primereact/ui/button';
2270
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
2271
+ import { IftaLabel } from '@primereact/ui/iftalabel';
2272
+ import { InputText } from '@primereact/ui/inputtext';
2273
+ import { Label } from '@primereact/ui/label';
2274
+ import * as React from 'react';
2275
+
2276
+ export default function IftaLabelDemo() {
2277
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
2278
+
2279
+ return (
2280
+ <div className="flex justify-center">
2281
+ <IftaLabel>
2282
+ <DatePicker.Root value={date} variant="filled" onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
2283
+ <DatePicker.Input as={InputText} id="date" />
2284
+ <DatePicker.Portal>
2285
+ <DatePicker.Positioner>
2286
+ <DatePicker.Popup>
2287
+ <DatePicker.Body>
2288
+ <DatePicker.Panel>
2289
+ <DatePicker.Calendar>
2290
+ <DatePicker.Header>
2291
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2292
+ <ChevronLeft />
2293
+ </DatePicker.Prev>
2294
+ <DatePicker.Title>
2295
+ <DatePicker.SelectMonth />
2296
+ <DatePicker.SelectYear />
2297
+ <DatePicker.Decade />
2298
+ </DatePicker.Title>
2299
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2300
+ <ChevronRight />
2301
+ </DatePicker.Next>
2302
+ </DatePicker.Header>
2303
+ <DatePicker.Table>
2304
+ <DatePicker.TableHead />
2305
+ <DatePicker.TableBody />
2306
+ <DatePicker.TableBody view="month" />
2307
+ <DatePicker.TableBody view="year" />
2308
+ </DatePicker.Table>
2309
+ </DatePicker.Calendar>
2310
+ </DatePicker.Panel>
2311
+ </DatePicker.Body>
2312
+ </DatePicker.Popup>
2313
+ </DatePicker.Positioner>
2314
+ </DatePicker.Portal>
2315
+ </DatePicker.Root>
2316
+ <Label htmlFor="date" className="mb-2">
2317
+ Date
2318
+ </Label>
2319
+ </IftaLabel>
2320
+ </div>
2321
+ );
2322
+ }
2323
+ ```
2324
+
2325
+ ### Clear
2326
+
2327
+ When `DatePicker.Clear` component is used, a clear trigger is added to reset the DatePicker.
2328
+
2329
+ ```tsx
2330
+ 'use client';
2331
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
2332
+ import { ChevronRight } from '@primeicons/react/chevron-right';
2333
+ import { Times } from '@primeicons/react/times';
2334
+ import { Button } from '@primereact/ui/button';
2335
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
2336
+ import { IconField } from '@primereact/ui/iconfield';
2337
+ import { InputText } from '@primereact/ui/inputtext';
2338
+ import * as React from 'react';
2339
+
2340
+ export default function ClearTriggerDemo() {
2341
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
2342
+
2343
+ return (
2344
+ <div className="flex justify-center">
2345
+ <DatePicker.Root value={date} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
2346
+ <IconField.Root className="w-full">
2347
+ <DatePicker.Input as={InputText} className="w-56!" />
2348
+ <IconField.Inset>
2349
+ <DatePicker.ClearTrigger>
2350
+ <Times />
2351
+ </DatePicker.ClearTrigger>
2352
+ </IconField.Inset>
2353
+ </IconField.Root>
2354
+ <DatePicker.Portal>
2355
+ <DatePicker.Positioner>
2356
+ <DatePicker.Popup>
2357
+ <DatePicker.Body>
2358
+ <DatePicker.Panel>
2359
+ <DatePicker.Calendar>
2360
+ <DatePicker.Header>
2361
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2362
+ <ChevronLeft />
2363
+ </DatePicker.Prev>
2364
+ <DatePicker.Title>
2365
+ <DatePicker.SelectMonth />
2366
+ <DatePicker.SelectYear />
2367
+ <DatePicker.Decade />
2368
+ </DatePicker.Title>
2369
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2370
+ <ChevronRight />
2371
+ </DatePicker.Next>
2372
+ </DatePicker.Header>
2373
+ <DatePicker.Table>
2374
+ <DatePicker.TableHead />
2375
+ <DatePicker.TableBody />
2376
+ <DatePicker.TableBody view="month" />
2377
+ <DatePicker.TableBody view="year" />
2378
+ </DatePicker.Table>
2379
+ </DatePicker.Calendar>
2380
+ </DatePicker.Panel>
2381
+ </DatePicker.Body>
2382
+ </DatePicker.Popup>
2383
+ </DatePicker.Positioner>
2384
+ </DatePicker.Portal>
2385
+ </DatePicker.Root>
2386
+ </div>
2387
+ );
2388
+ }
2389
+ ```
2390
+
2391
+ ### Sizes
2392
+
2393
+ DatePicker provides `small` and `large` sizes as alternatives to the base.
2394
+
2395
+ ```tsx
2396
+ 'use client';
2397
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
2398
+ import { ChevronRight } from '@primeicons/react/chevron-right';
2399
+ import { Button } from '@primereact/ui/button';
2400
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
2401
+
2402
+ import { InputText } from '@primereact/ui/inputtext';
2403
+ import * as React from 'react';
2404
+
2405
+ export default function SizesDemo() {
2406
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
2407
+ const [date2, setDate2] = React.useState<DatePickerRootProps['value'] | null>(null);
2408
+ const [date3, setDate3] = React.useState<DatePickerRootProps['value'] | null>(null);
2409
+
2410
+ return (
2411
+ <div className="flex flex-col items-center gap-4">
2412
+ <DatePicker.Root value={date} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
2413
+ <DatePicker.Input as={InputText} size="small" placeholder="Small" />
2414
+ <DatePicker.Portal>
2415
+ <DatePicker.Positioner>
2416
+ <DatePicker.Popup>
2417
+ <DatePicker.Body>
2418
+ <DatePicker.Panel>
2419
+ <DatePicker.Calendar>
2420
+ <DatePicker.Header>
2421
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2422
+ <ChevronLeft />
2423
+ </DatePicker.Prev>
2424
+ <DatePicker.Title>
2425
+ <DatePicker.SelectMonth />
2426
+ <DatePicker.SelectYear />
2427
+ <DatePicker.Decade />
2428
+ </DatePicker.Title>
2429
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2430
+ <ChevronRight />
2431
+ </DatePicker.Next>
2432
+ </DatePicker.Header>
2433
+ <DatePicker.Table>
2434
+ <DatePicker.TableHead />
2435
+ <DatePicker.TableBody />
2436
+ <DatePicker.TableBody view="month" />
2437
+ <DatePicker.TableBody view="year" />
2438
+ </DatePicker.Table>
2439
+ </DatePicker.Calendar>
2440
+ </DatePicker.Panel>
2441
+ </DatePicker.Body>
2442
+ </DatePicker.Popup>
2443
+ </DatePicker.Positioner>
2444
+ </DatePicker.Portal>
2445
+ </DatePicker.Root>
2446
+
2447
+ <DatePicker.Root value={date2} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate2(event.value)}>
2448
+ <DatePicker.Input as={InputText} placeholder="Normal" />
2449
+ <DatePicker.Portal>
2450
+ <DatePicker.Positioner>
2451
+ <DatePicker.Popup>
2452
+ <DatePicker.Body>
2453
+ <DatePicker.Panel>
2454
+ <DatePicker.Calendar>
2455
+ <DatePicker.Header>
2456
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2457
+ <ChevronLeft />
2458
+ </DatePicker.Prev>
2459
+ <DatePicker.Title>
2460
+ <DatePicker.SelectMonth />
2461
+ <DatePicker.SelectYear />
2462
+ <DatePicker.Decade />
2463
+ </DatePicker.Title>
2464
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2465
+ <ChevronRight />
2466
+ </DatePicker.Next>
2467
+ </DatePicker.Header>
2468
+ <DatePicker.Table>
2469
+ <DatePicker.TableHead />
2470
+ <DatePicker.TableBody />
2471
+ <DatePicker.TableBody view="month" />
2472
+ <DatePicker.TableBody view="year" />
2473
+ </DatePicker.Table>
2474
+ </DatePicker.Calendar>
2475
+ </DatePicker.Panel>
2476
+ </DatePicker.Body>
2477
+ </DatePicker.Popup>
2478
+ </DatePicker.Positioner>
2479
+ </DatePicker.Portal>
2480
+ </DatePicker.Root>
2481
+
2482
+ <DatePicker.Root value={date3} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate3(event.value)}>
2483
+ <DatePicker.Input as={InputText} size="large" placeholder="Large" />
2484
+ <DatePicker.Portal>
2485
+ <DatePicker.Positioner>
2486
+ <DatePicker.Popup>
2487
+ <DatePicker.Body>
2488
+ <DatePicker.Panel>
2489
+ <DatePicker.Calendar>
2490
+ <DatePicker.Header>
2491
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2492
+ <ChevronLeft />
2493
+ </DatePicker.Prev>
2494
+ <DatePicker.Title>
2495
+ <DatePicker.SelectMonth />
2496
+ <DatePicker.SelectYear />
2497
+ <DatePicker.Decade />
2498
+ </DatePicker.Title>
2499
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2500
+ <ChevronRight />
2501
+ </DatePicker.Next>
2502
+ </DatePicker.Header>
2503
+ <DatePicker.Table>
2504
+ <DatePicker.TableHead />
2505
+ <DatePicker.TableBody />
2506
+ <DatePicker.TableBody view="month" />
2507
+ <DatePicker.TableBody view="year" />
2508
+ </DatePicker.Table>
2509
+ </DatePicker.Calendar>
2510
+ </DatePicker.Panel>
2511
+ </DatePicker.Body>
2512
+ </DatePicker.Popup>
2513
+ </DatePicker.Positioner>
2514
+ </DatePicker.Portal>
2515
+ </DatePicker.Root>
2516
+ </div>
2517
+ );
2518
+ }
2519
+ ```
2520
+
2521
+ ### Fluid
2522
+
2523
+ The fluid prop makes the component take up the full width of its container when set to true.
2524
+
2525
+ ```tsx
2526
+ 'use client';
2527
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
2528
+ import { ChevronRight } from '@primeicons/react/chevron-right';
2529
+ import { Button } from '@primereact/ui/button';
2530
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
2531
+ import { InputText } from '@primereact/ui/inputtext';
2532
+ import * as React from 'react';
2533
+
2534
+ export default function FluidDemo() {
2535
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
2536
+
2537
+ return (
2538
+ <DatePicker.Root value={date} fluid onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
2539
+ <DatePicker.Input as={InputText} fluid />
2540
+ <DatePicker.Portal>
2541
+ <DatePicker.Positioner>
2542
+ <DatePicker.Popup>
2543
+ <DatePicker.Body>
2544
+ <DatePicker.Panel>
2545
+ <DatePicker.Calendar>
2546
+ <DatePicker.Header>
2547
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2548
+ <ChevronLeft />
2549
+ </DatePicker.Prev>
2550
+ <DatePicker.Title>
2551
+ <DatePicker.SelectMonth />
2552
+ <DatePicker.SelectYear />
2553
+ <DatePicker.Decade />
2554
+ </DatePicker.Title>
2555
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2556
+ <ChevronRight />
2557
+ </DatePicker.Next>
2558
+ </DatePicker.Header>
2559
+ <DatePicker.Table>
2560
+ <DatePicker.TableHead />
2561
+ <DatePicker.TableBody />
2562
+ <DatePicker.TableBody view="month" />
2563
+ <DatePicker.TableBody view="year" />
2564
+ </DatePicker.Table>
2565
+ </DatePicker.Calendar>
2566
+ </DatePicker.Panel>
2567
+ </DatePicker.Body>
2568
+ </DatePicker.Popup>
2569
+ </DatePicker.Positioner>
2570
+ </DatePicker.Portal>
2571
+ </DatePicker.Root>
2572
+ );
2573
+ }
2574
+ ```
2575
+
2576
+ ### Filled
2577
+
2578
+ Specify the `filled` property to display the component with a higher visual emphasis than the default outlined style.
2579
+
2580
+ ```tsx
2581
+ 'use client';
2582
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
2583
+ import { ChevronRight } from '@primeicons/react/chevron-right';
2584
+ import { Button } from '@primereact/ui/button';
2585
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
2586
+ import { InputText } from '@primereact/ui/inputtext';
2587
+ import * as React from 'react';
2588
+
2589
+ export default function FilledDemo() {
2590
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
2591
+
2592
+ return (
2593
+ <div className="flex justify-center">
2594
+ <DatePicker.Root value={date} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
2595
+ <DatePicker.Input as={InputText} variant="filled" />
2596
+ <DatePicker.Portal>
2597
+ <DatePicker.Positioner>
2598
+ <DatePicker.Popup>
2599
+ <DatePicker.Body>
2600
+ <DatePicker.Panel>
2601
+ <DatePicker.Calendar>
2602
+ <DatePicker.Header>
2603
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2604
+ <ChevronLeft />
2605
+ </DatePicker.Prev>
2606
+ <DatePicker.Title>
2607
+ <DatePicker.SelectMonth />
2608
+ <DatePicker.SelectYear />
2609
+ <DatePicker.Decade />
2610
+ </DatePicker.Title>
2611
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2612
+ <ChevronRight />
2613
+ </DatePicker.Next>
2614
+ </DatePicker.Header>
2615
+ <DatePicker.Table>
2616
+ <DatePicker.TableHead />
2617
+ <DatePicker.TableBody />
2618
+ <DatePicker.TableBody view="month" />
2619
+ <DatePicker.TableBody view="year" />
2620
+ </DatePicker.Table>
2621
+ </DatePicker.Calendar>
2622
+ </DatePicker.Panel>
2623
+ </DatePicker.Body>
2624
+ </DatePicker.Popup>
2625
+ </DatePicker.Positioner>
2626
+ </DatePicker.Portal>
2627
+ </DatePicker.Root>
2628
+ </div>
2629
+ );
2630
+ }
2631
+ ```
2632
+
2633
+ ### Disabled
2634
+
2635
+ Use the `disabled` property to disable a datepicker.
2636
+
2637
+ ```tsx
2638
+ 'use client';
2639
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
2640
+ import { ChevronRight } from '@primeicons/react/chevron-right';
2641
+ import { Button } from '@primereact/ui/button';
2642
+ import { DatePicker } from '@primereact/ui/datepicker';
2643
+ import { InputText } from '@primereact/ui/inputtext';
2644
+
2645
+ export default function DisabledDemo() {
2646
+ return (
2647
+ <div className="flex justify-center">
2648
+ <DatePicker.Root>
2649
+ <DatePicker.Input as={InputText} disabled />
2650
+ <DatePicker.Portal>
2651
+ <DatePicker.Positioner>
2652
+ <DatePicker.Popup>
2653
+ <DatePicker.Body>
2654
+ <DatePicker.Panel>
2655
+ <DatePicker.Calendar>
2656
+ <DatePicker.Header>
2657
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2658
+ <ChevronLeft />
2659
+ </DatePicker.Prev>
2660
+ <DatePicker.Title>
2661
+ <DatePicker.SelectMonth />
2662
+ <DatePicker.SelectYear />
2663
+ <DatePicker.Decade />
2664
+ </DatePicker.Title>
2665
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2666
+ <ChevronRight />
2667
+ </DatePicker.Next>
2668
+ </DatePicker.Header>
2669
+ <DatePicker.Table>
2670
+ <DatePicker.TableHead />
2671
+ <DatePicker.TableBody />
2672
+ <DatePicker.TableBody view="month" />
2673
+ <DatePicker.TableBody view="year" />
2674
+ </DatePicker.Table>
2675
+ </DatePicker.Calendar>
2676
+ </DatePicker.Panel>
2677
+ </DatePicker.Body>
2678
+ </DatePicker.Popup>
2679
+ </DatePicker.Positioner>
2680
+ </DatePicker.Portal>
2681
+ </DatePicker.Root>
2682
+ </div>
2683
+ );
2684
+ }
2685
+ ```
2686
+
2687
+ ### Invalid
2688
+
2689
+ Specify the `invalid` property to display the component with a red border.
2690
+
2691
+ ```tsx
2692
+ 'use client';
2693
+ import { ChevronLeft } from '@primeicons/react/chevron-left';
2694
+ import { ChevronRight } from '@primeicons/react/chevron-right';
2695
+ import { Button } from '@primereact/ui/button';
2696
+ import { DatePicker, type DatePickerRootProps, type DatePickerRootValueChangeEvent } from '@primereact/ui/datepicker';
2697
+
2698
+ import { InputText } from '@primereact/ui/inputtext';
2699
+ import * as React from 'react';
2700
+
2701
+ export default function InvalidDemo() {
2702
+ const [date, setDate] = React.useState<DatePickerRootProps['value'] | null>(null);
2703
+ const [date2, setDate2] = React.useState<DatePickerRootProps['value'] | null>(null);
2704
+
2705
+ return (
2706
+ <div className="flex flex-wrap justify-center gap-4">
2707
+ <DatePicker.Root value={date} onValueChange={(event: DatePickerRootValueChangeEvent) => setDate(event.value)}>
2708
+ <DatePicker.Input as={InputText} invalid={!date} placeholder="Date" />
2709
+ <DatePicker.Portal>
2710
+ <DatePicker.Positioner>
2711
+ <DatePicker.Popup>
2712
+ <DatePicker.Body>
2713
+ <DatePicker.Panel>
2714
+ <DatePicker.Calendar>
2715
+ <DatePicker.Header>
2716
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2717
+ <ChevronLeft />
2718
+ </DatePicker.Prev>
2719
+ <DatePicker.Title>
2720
+ <DatePicker.SelectMonth />
2721
+ <DatePicker.SelectYear />
2722
+ <DatePicker.Decade />
2723
+ </DatePicker.Title>
2724
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2725
+ <ChevronRight />
2726
+ </DatePicker.Next>
2727
+ </DatePicker.Header>
2728
+ <DatePicker.Table>
2729
+ <DatePicker.TableHead />
2730
+ <DatePicker.TableBody />
2731
+ <DatePicker.TableBody view="month" />
2732
+ <DatePicker.TableBody view="year" />
2733
+ </DatePicker.Table>
2734
+ </DatePicker.Calendar>
2735
+ </DatePicker.Panel>
2736
+ </DatePicker.Body>
2737
+ </DatePicker.Popup>
2738
+ </DatePicker.Positioner>
2739
+ </DatePicker.Portal>
2740
+ </DatePicker.Root>
2741
+ <DatePicker.Root value={date2} variant="filled" onValueChange={(event: DatePickerRootValueChangeEvent) => setDate2(event.value)}>
2742
+ <DatePicker.Input as={InputText} invalid={!date2} placeholder="Date" />
2743
+ <DatePicker.Portal>
2744
+ <DatePicker.Positioner>
2745
+ <DatePicker.Popup>
2746
+ <DatePicker.Body>
2747
+ <DatePicker.Panel>
2748
+ <DatePicker.Calendar>
2749
+ <DatePicker.Header>
2750
+ <DatePicker.Prev as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2751
+ <ChevronLeft />
2752
+ </DatePicker.Prev>
2753
+ <DatePicker.Title>
2754
+ <DatePicker.SelectMonth />
2755
+ <DatePicker.SelectYear />
2756
+ <DatePicker.Decade />
2757
+ </DatePicker.Title>
2758
+ <DatePicker.Next as={Button} iconOnly variant="text" rounded severity="secondary" size="small">
2759
+ <ChevronRight />
2760
+ </DatePicker.Next>
2761
+ </DatePicker.Header>
2762
+ <DatePicker.Table>
2763
+ <DatePicker.TableHead />
2764
+ <DatePicker.TableBody />
2765
+ <DatePicker.TableBody view="month" />
2766
+ <DatePicker.TableBody view="year" />
2767
+ </DatePicker.Table>
2768
+ </DatePicker.Calendar>
2769
+ </DatePicker.Panel>
2770
+ </DatePicker.Body>
2771
+ </DatePicker.Popup>
2772
+ </DatePicker.Positioner>
2773
+ </DatePicker.Portal>
2774
+ </DatePicker.Root>
2775
+ </div>
2776
+ );
2777
+ }
2778
+ ```
2779
+
2780
+ ## Related
2781
+
2782
+ ### Sub-Components
2783
+
2784
+ See [Primitive API](/docs/primitive/components/datepicker#api) for `DatePickerRoot`, `DatePickerInput`, `DatePickerPopup`, `DatePickerCalendar`, `DatePickerDay`, `DatePickerMonth`, `DatePickerYear`, and all other sub-component documentation.
2785
+
2786
+ ### Hooks
2787
+
2788
+ See [Headless API](/docs/headless/components/datepicker#api) for `useDatePicker` hook documentation.
2789
+
2790
+ ### Accessibility
2791
+
2792
+ See [DatePicker Primitive](/docs/primitive/components/datepicker#accessibility) for WAI-ARIA compliance details and keyboard support.
2793
+
2794
+
2795
+ ## Theming
2796
+
2797
+ ### CSS Classes
2798
+
2799
+ List of class names used in the styled mode.
2800
+
2801
+ <DocTable name="DatePicker" category="style" />
2802
+
2803
+ ### Design Tokens
2804
+
2805
+ List of design tokens.
2806
+
2807
+ <DocTable name="DatePicker" category="token" />