The Date Range component for Retool Apps
An input field to select or enter a date range.
For more information about using the Date Range component, refer to the dates and times guide.
Properties
All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.
endPlaceholder
The text to display in the input field when the end date is empty.
Type | string |
Configurability | Inspector |
events
A list of configured event handlers that trigger actions or queries.
Type | array |
Array values | object |
Configurability | Inspector > Interaction > Event handlers |
Array Object Properties
event
The event that triggers the action. Refer to the events section for details of available events for this object.
Type | string |
Configurability | Inspector > Interaction > Event handlers > Event |
method
The JavaScript method to perform when type
is datasource
, widget
, state
, or localStorage
.
Type | string |
Configurability | Inspector > Interaction > Event handlers > Edit event handler > Run script actions |
type
The type of action to perform.
Type | string | ||||||||||||||
Configurability | Inspector > Interaction > Event handlers > Edit event handler > Action | ||||||||||||||
Allowed Values |
|
hidden
Whether this object is hidden from view.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Hidden |
Default |
|
Examples
true
id
The unique identifier (name).
Type | string |
Format | Plain Text |
Configurability | Inspector |
Default |
|
Examples
query1
button1
isHiddenOnDesktop
Whether to show or hide this object in the desktop layout.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Show on desktop |
Default |
|
Examples
true
isHiddenOnMobile
Whether to show or hide this object in the mobile layout.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Show on mobile |
Default |
|
Examples
true
maintainSpaceWhenHidden
Whether to take up space on the canvas if hidden
is true
.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Maintain space when hidden |
Default |
|
Examples
true
margin
The amount of margin to render outside.
Type | string | |||||||||
Format | Plain Text | |||||||||
Configurability | Inspector > Spacing > Margin | |||||||||
Allowed Values |
| |||||||||
Default |
|
Examples
4px 8px
showInEditor
Whether the component remains visible in the editor if hidden
is true
.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Advanced > Always show in edit mode |
Default |
|
Examples
true
startPlaceholder
The text to display in the input field when the start date is empty.
Type | string |
Configurability | Inspector |
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
dateRange.clearValidation()
Examples
Clear the validation message from dateRange
.
dateRange.clearValidation();
dateRange.clearValue()
Examples
Clear the current value of dateRange
.
dateRange.clearValue();
dateRange.focus()
Examples
Set focus on dateRange
.
dateRange.focus();
dateRange.resetValue()
Examples
Reset the current value of dateRange
.
dateRange.resetValue();
dateRange.scrollIntoView()
Scrolls the canvas or parent container so that the selected component appears in the visible area.
dateRange.scrollIntoView(options)
Parameters
Object Properties
behavior
The scroll behavior.
Type | string | ||||||
Allowed Values |
|
block
The scroll position relative to the component.
Type | string | ||||||||||
Allowed Values |
|
Examples
Scroll the minimum amount to immediately bring dateRange
into view.
dateRange.scrollIntoView({behavior: 'auto', block: 'nearest'});
dateRange.setDisabled()
Set the disabled
value to toggle whether the input field is disabled. Defaults to true
without a parameter.
dateRange.setDisabled(disabled)
Parameters
disabled
Whether input, interaction, selection, or triggering is disabled.
Type | boolean |
Format | True/False |
Default |
|
Examples
true
Examples
Disable dateRange
.
dateRange.setDisabled(true);
Enable dateRange
.
dateRange.setDisabled(false);
dateRange.setEndRange(end)
dateRange.setHidden()
Set the hidden
value to toggle whether the component is visible. Defaults to true
without a parameter.
dateRange.setHidden(hidden)
Parameters
Examples
true
Examples
Hide dateRange
.
dateRange.setHidden(true);
Unhide dateRange
.
dateRange.setHidden(false);
dateRange.setRange(options)
dateRange.setStartRange(start)
dateRange.setValue(key, value)
Examples
Set the current value of dateRange
to userValue
.
dateRange.setValue(userValue);
dateRange.validate()
Examples
Validate the value of dateRange
.
dateRange.validate();
Events
Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.
Event | Description |
---|---|
Blur | The input field is deselected. |
Change | The value is changed. |
Focus | The input field is selected. |
Submit | The value is submitted. |