Files
zeekay 464e1eece0 State a version once
A version written into a manifest is written into every manifest that wants it,
which is how eslint came to exist in a hundred and four forms across this estate
and how a package came to resolve twice at run time. The catalog moves the number
out of the manifest: a manifest names the package, the workspace names the
version.

Four are held below their latest because the newer release cannot be used, and
the reason is recorded rather than the version alone: @noble/hashes 2 renamed
every subpath the web3 stack imports, @splinetool/runtime 2 depends on a package
that was never published, @dynamic-labs 5.4.1 the same, and react-resizable-panels
3 points its types condition at the bundle.
2026-09-15 11:45:32 -07:00

110 lines
2.6 KiB
Plaintext

import { Meta, Controls, Primary } from '@storybook/addon-docs/blocks';
import * as CalendarStories from './calendar.stories';
<Meta of={CalendarStories} />
# Calendar
Calendar is a styled re-export of [React DayPicker](https://daypicker.dev/). It uses the same API as DayPicker; for the full list of props and behavior, see the [DayPicker documentation](https://daypicker.dev/).
## How to use
### Basic usage (no selection)
```tsx
import { Calendar } from '@signozhq/ui';
export default function MyComponent() {
return <Calendar />;
}
```
### Single date selection
```tsx
import { Calendar } from '@signozhq/ui';
export default function SingleDatePicker() {
const [date, setDate] = React.useState<Date | undefined>();
return (
<Calendar
mode="single"
selected={date}
onSelect={setDate}
style={{ borderRadius: 'calc(.25rem - 2px)', borderStyle: 'solid', borderWidth: 1, boxShadow: '0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a' }}
/>
);
}
```
### Date range selection
```tsx
import { Calendar } from '@signozhq/ui';
export default function RangePicker() {
const [range, setRange] = React.useState<{
from: Date | undefined;
to: Date | undefined;
}>({ from: undefined, to: undefined });
return (
<Calendar
mode="range"
selected={range}
onSelect={setRange}
style={{ borderRadius: 'calc(.25rem - 2px)', borderStyle: 'solid', borderWidth: 1, boxShadow: '0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a' }}
/>
);
}
```
### Multiple dates selection
```tsx
import { Calendar } from '@signozhq/ui';
export default function MultiplePicker() {
const [selected, setSelected] = React.useState<Date[]>([]);
return (
<Calendar
mode="multiple"
selected={selected}
onSelect={setSelected}
style={{ borderRadius: 'calc(.25rem - 2px)', borderStyle: 'solid', borderWidth: 1, boxShadow: '0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a' }}
/>
);
}
```
### Disabling specific days (e.g. weekends)
```tsx
import { Calendar } from '@signozhq/ui';
export default function CalendarWithDisabledDays() {
const [date, setDate] = React.useState<Date | undefined>();
return (
<Calendar
mode="single"
selected={date}
onSelect={setDate}
disabled={[{ dayOfWeek: [0, 6] }]}
/>
);
}
```
Default calendar with single selection:
<Primary />
## Calendar Props
The component accepts all [DayPicker props](https://daypicker.dev/api/interfaces/PropsBase). Common options are listed below.
<Controls of={CalendarStories.Default} />