mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
* chore(example): add inlineDynamicImports: true * docs(date-picker): add note for using DatePicker with Rollup Closes #986
93 lines
2.2 KiB
Text
93 lines
2.2 KiB
Text
---
|
|
components: ["DatePicker", "DatePickerInput", "DatePickerSkeleton"]
|
|
---
|
|
|
|
<script>
|
|
import { DatePicker, DatePickerSkeleton, DatePickerInput, InlineNotification } from "carbon-components-svelte";
|
|
import Preview from "../../components/Preview.svelte";
|
|
</script>
|
|
|
|
### Default (simple)
|
|
|
|
<DatePicker>
|
|
<DatePickerInput labelText="Date of birth" placeholder="mm/dd/yyyy" />
|
|
</DatePicker>
|
|
|
|
### With helper text
|
|
|
|
<DatePicker>
|
|
<DatePickerInput labelText="Date of birth" helperText="Example: 01/12/1990" placeholder="mm/dd/yyyy" />
|
|
</DatePicker>
|
|
|
|
### Hidden label
|
|
|
|
<DatePicker>
|
|
<DatePickerInput hideLabel labelText="Date of birth" placeholder="mm/dd/yyyy" />
|
|
</DatePicker>
|
|
|
|
### Light variant
|
|
|
|
<DatePicker light>
|
|
<DatePickerInput labelText="Date of birth" placeholder="mm/dd/yyyy" />
|
|
</DatePicker>
|
|
|
|
### Extra-large size
|
|
|
|
<DatePicker>
|
|
<DatePickerInput size="xl" labelText="Date of birth" placeholder="mm/dd/yyyy" />
|
|
</DatePicker>
|
|
|
|
### Small size
|
|
|
|
<DatePicker>
|
|
<DatePickerInput size="sm" labelText="Date of birth" placeholder="mm/dd/yyyy" />
|
|
</DatePicker>
|
|
|
|
### Invalid state
|
|
|
|
<DatePicker>
|
|
<DatePickerInput invalid invalidText="Invalid date" labelText="Date of birth" placeholder="mm/dd/yyyy" />
|
|
</DatePicker>
|
|
|
|
### Warning state
|
|
|
|
<DatePicker>
|
|
<DatePickerInput warn warnText="This info will not be stored" labelText="Date of birth" placeholder="mm/dd/yyyy" />
|
|
</DatePicker>
|
|
|
|
### Disabled state
|
|
|
|
<DatePicker>
|
|
<DatePickerInput disabled labelText="Date of birth" placeholder="mm/dd/yyyy" />
|
|
</DatePicker>
|
|
|
|
### Single
|
|
|
|
<InlineNotification
|
|
svx-ignore
|
|
lowContrast
|
|
title="Note:"
|
|
subtitle="If using Rollup, specify `inlineDynamicImports: true` in your `rollup.config.js`."
|
|
kind="info"
|
|
hideCloseButton
|
|
/>
|
|
|
|
<FileSource src="/framed/DatePicker/DatePickerSingle" />
|
|
|
|
### Range
|
|
|
|
<FileSource src="/framed/DatePicker/DatePickerRange" />
|
|
|
|
### DatePicker in a modal
|
|
|
|
Use `flatpickrProps` to set `static: true` for the calendar to be positioned relative to the input element.
|
|
|
|
This is needed when placing a `DatePicker` inside of a `Modal` component.
|
|
|
|
Refer to [flatpickr options](https://flatpickr.js.org/options/) for a full list of config options.
|
|
|
|
<FileSource src="/framed/DatePicker/DatePickerModal" />
|
|
|
|
### Skeleton
|
|
|
|
<DatePickerSkeleton />
|