# DatePicker

Pairs a Calendar inside a Popover with a button that reads back the chosen date. Use it wherever a date needs picking rather than typing.

Package: `@kela-systems/ui-components` 4.1.0

```tsx
import { DatePicker } from "@kela-systems/ui-components";
```

Links (Kela sign-in needed): [Storybook](https://main--6af1efd9453270bb59a6c00c.chromatic.com/?path=/docs/components-datepicker--docs), [Source](https://github.com/Kela-Systems/kela/tree/main/packages/next/ui-components/src/date-picker), [Figma](https://www.figma.com/design/anhlwrbFM6mUiL0klxeK1I/ARK---Design-System?node-id=244-2898)

## Props

A `className` on a part adds layout only: placement, sizing and spacing. Pick a look with a variant.

### DatePicker

| Variant | Values | Default |
| --- | --- | --- |
| `variant` | `default`, `secondary`, `destructive`, `outline`, `ghost`, `link` | `default` |
| `size` | `default`, `xs`, `sm`, `lg`, `icon`, `icon-xs`, `icon-sm`, `icon-lg` | `default` |
| `captionLayout` | `label`, `dropdown`, `dropdown-months`, `dropdown-years` | `label` |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `loading` | `boolean` |  | Shows a spinner and prevents interaction while keeping the variant's resting colors. |
| `value` | `Date` |  |  |
| `defaultValue` | `Date` |  |  |
| `onValueChange` | `(date: Date \| undefined) => void` |  |  |
| `placeholder` | `string` | `Select date` |  |
| `locale` | `React.ComponentProps<typeof Calendar>["locale"]` |  |  |
| `formatValue` | `(date: Date \| undefined) => string \| undefined` | `(date) => formatDate(date, locale?.code)` | Renders the trigger's label. Defaults to a long date in `locale`, or the user's locale without one. |

Also takes the props of `@base-ui/react/button`.
