You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/components/date-range-picker.md
+93-20Lines changed: 93 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,16 +109,53 @@ The Angular Date Range Picker component also allows configuring two separate inp
109
109
```html
110
110
<igx-date-range-picker[(ngModel)]="range">
111
111
<igx-date-range-start>
112
+
<igx-picker-toggleigxPrefix>
113
+
<igx-icon>calendar_today</igx-icon>
114
+
</igx-picker-toggle>
115
+
<labeligxLabel>Start Date</label>
112
116
<inputigxInputigxDateTimeEditortype="text">
117
+
<igx-picker-clearigxSuffix>
118
+
<igx-icon>clear</igx-icon>
119
+
</igx-picker-clear>
113
120
</igx-date-range-start>
114
121
<igx-date-range-end>
122
+
<igx-picker-toggleigxPrefix>
123
+
<igx-icon>calendar_today</igx-icon>
124
+
</igx-picker-toggle>
125
+
<labeligxLabel>End Date</label>
115
126
<inputigxInputigxDateTimeEditortype="text">
127
+
<igx-picker-clearigxSuffix>
128
+
<igx-icon>clear</igx-icon>
129
+
</igx-picker-clear>
116
130
</igx-date-range-end>
117
131
</igx-date-range-picker>
118
132
```
119
133
120
-
- Both the [`IgxDateRangeStartComponent`]({environment:angularApiUrl}/classes/igxdaterangestartcomponent.html) and [`IgxDateRangeEndComponent`]({environment:angularApiUrl}/classes/igxdaterangeendcomponent.html) extend the existing [`IgxInputGroupComponent`](input-group.md). For such a configuration to work, defining an [`IgxInput`]({environment:angularApiUrl}/classes/igxinputdirective.html) is required. In addition, all other components and directives available to the [`IgxInputGroupComponent`](input-group.md) can also be used.
121
-
- In order to enable date editing for both inputs, you need to decorate them with [`igxDateTimeEditor`](date-time-editor.md) directive.
134
+
>[!NOTE]
135
+
> In the two-input configuration, place the `input` directly inside `igx-date-range-start` and `igx-date-range-end`.
136
+
>
137
+
> To open the calendar from an icon, use `igx-picker-toggle` with `igxPrefix` applied directly to it:
138
+
>
139
+
> ```html
140
+
> <igx-picker-toggleigxPrefix>
141
+
> <igx-icon>calendar_today</igx-icon>
142
+
> </igx-picker-toggle>
143
+
> ```
144
+
>
145
+
> To show a clear action, use `igx-picker-clear` with `igxSuffix` applied directly to it:
146
+
>
147
+
> ```html
148
+
> <igx-picker-clearigxSuffix>
149
+
> <igx-icon>clear</igx-icon>
150
+
> </igx-picker-clear>
151
+
> ```
152
+
>
153
+
154
+
- [`IgxDateRangeStartComponent`]({environment:angularApiUrl}/classes/igxdaterangestartcomponent.html) and [`IgxDateRangeEndComponent`]({environment:angularApiUrl}/classes/igxdaterangeendcomponent.html) support projected content such as labels, hints, picker toggles, and clear buttons.
155
+
- Use `igx-picker-toggle` for the calendar action and `igx-picker-clear` for the clear action.
156
+
- Apply `igxPrefix` directly to `igx-picker-toggle` and `igxSuffix` directly to `igx-picker-clear`.
157
+
- Add the [`IgxInput`]({environment:angularApiUrl}/classes/igxinputdirective.html) directly inside each component.
158
+
- To enable date editing, decorate both inputs with the [`igxDateTimeEditor`](date-time-editor.md) directive.
122
159
123
160
<code-viewstyle="height:600px"
124
161
data-demos-base-url="{environment:demosBaseUrl}"
@@ -127,7 +164,7 @@ The Angular Date Range Picker component also allows configuring two separate inp
127
164
128
165
### Popup modes
129
166
130
-
By default, when clicked, the [`IgxDateRangePickerComponent`]({environment:angularApiUrl}/classes/igxdaterangepickercomponent.html) opens its calendar pop-up in `dropdown` mode. Alternatively, the calendar can be opened in `dialog` mode by setting the `Mode` property to `dialog`.
167
+
By default, the [`IgxDateRangePickerComponent`]({environment:angularApiUrl}/classes/igxdaterangepickercomponent.html) opens its calendar pop-up in `dropdown` mode. Alternatively, the calendar can be opened in `dialog` mode by setting the `mode` property to `dialog`.
@@ -140,7 +177,11 @@ By default, when clicked, the [`IgxDateRangePickerComponent`]({environment:angul
140
177
141
178
<divclass="divider--half"></div>
142
179
143
-
In a default configuration with a single read-only input, the calendar can be opened by clicking anywhere in the input, including the calendar icon. When there are two separate inputs for start and end date, and in dropdown mode, the calendar can only be opened from the calendar icon, since both inputs are editable by default. For two inputs in `dialog` mode, clicking anywhere in the input opens the calendar
180
+
In the default single-input configuration, the calendar opens when you click the input or the calendar icon.
181
+
182
+
When using two separate inputs in `dropdown` mode, the inputs remain editable, so the calendar is typically opened from the picker toggle.
183
+
184
+
When using two separate inputs in `dialog` mode, clicking either input opens the calendar.
144
185
145
186
The range value is set when dates are picked from the calendar. You will notice that in dropdown mode, the `Done` button is not available. In dialog mode, a `Cancel` button allows to revert the selection on close.
@@ -227,20 +278,33 @@ In the default configuration, with a single read-only input, a default calendar
227
278
228
279
When a Date Range Picker has two separate inputs for start and end dates, it doesn't expose these icons by default. The [`IgxPickerToggleComponent`]({environment:angularApiUrl}/classes/igxpickertogglecomponent.html) and [`IgxPickerClearComponent`]({environment:angularApiUrl}/classes/igxpickerclearcomponent.html) should be manually added as children of the [`IgxDateRangeStartComponent`]({environment:angularApiUrl}/classes/igxdaterangestartcomponent.html) or [`IgxDateRangeEndComponent`]({environment:angularApiUrl}/classes/igxdaterangeendcomponent.html) like so:
229
280
281
+
>[!NOTE]
282
+
> In the two-input configuration:
283
+
>
284
+
> - use `igx-picker-toggle igxPrefix` for the calendar action
285
+
> - use `igx-picker-clear igxSuffix` for the clear action
286
+
230
287
```html
231
288
<igx-date-range-picker>
232
289
<igx-date-range-start>
233
-
...
234
290
<igx-picker-toggleigxPrefix>
235
291
<igx-icon>calendar_view_day</igx-icon>
236
292
</igx-picker-toggle>
293
+
<labeligxLabel>Start Date</label>
294
+
<inputigxInputigxDateTimeEditortype="text">
237
295
<igx-picker-clearigxSuffix>
238
296
<igx-icon>clear</igx-icon>
239
297
</igx-picker-clear>
240
-
...
241
298
</igx-date-range-start>
242
299
<igx-date-range-end>
243
-
...
300
+
<igx-picker-toggleigxPrefix>
301
+
<igx-icon>calendar_view_day</igx-icon>
302
+
</igx-picker-toggle>
303
+
<labeligxLabel>End Date</label>
304
+
<inputigxInputigxDateTimeEditortype="text">
305
+
<igx-picker-clearigxSuffix>
306
+
<igx-icon>clear</igx-icon>
307
+
</igx-picker-clear>
244
308
</igx-date-range-end>
245
309
</igx-date-range-picker>
246
310
```
@@ -320,15 +384,24 @@ The same configuration can be used when setting two separate inputs. Note that i
@@ -398,7 +471,7 @@ The `IgxDateRangePickerComponent` is also a validator which means it controls it
398
471
</div>
399
472
```
400
473
401
-
### Disabled And Special dates
474
+
### Disabled and Special Dates
402
475
403
476
You also have the ability to set disabled dates in the calendar to narrow the range of dates the user can choose from. To set the disabled dates, you can use the [`disabledDates`]({environment:angularApiUrl}/classes/igxdaterangepickercomponent.html#disabledDates) property.
404
477
@@ -411,10 +484,10 @@ export class DateRangeSampleComponent implements OnInit {
411
484
412
485
public ngOnInit() {
413
486
this.dateRange.disabledDates= [
414
-
{
415
-
type: DateRangeType.Between,
416
-
dateRange: [minDate, maxDate]
417
-
}
487
+
{
488
+
type: DateRangeType.Between,
489
+
dateRange: [this.minDate, this.maxDate]
490
+
}
418
491
] asDateRangeDescriptor[];
419
492
}
420
493
}
@@ -474,10 +547,10 @@ The header, subheader and title parts of the calendar header can be customized b
0 commit comments