The Year component for Retool Apps
A dropdown menu and input field to select or enter a year.
Year is a preset version of Select. It has been preconfigured with a list of values.
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.
allowCustomValue
Whether to allow values that do not exist in values.
| Type | boolean |
| Format | True/False |
| Configurability | Inspector |
| Default | false |
Examples
falsetrue
allowDeselect
Whether to allow deselection of an item.
| Type | boolean |
| Format | True/False |
| Configurability | Inspector |
| Default | false |
Examples
falsetrue
clearInputValueOnChange
Whether to clear the input value when the selection changes.
| Type | boolean |
| Configurability | Inspector |
| Default | null |
deprecatedLabels
A list of labels (deprecated).
| Type | array |
| Array values | string |
| Configurability | Read-only |
| Default | null |
disabled
Whether input, interaction, selection, or triggering is disabled.
| Type | boolean |
| Format | True/False |
| Configurability | Inspector > Interaction > Disabled |
| Default | false |
Examples
falsetrue
disabledValues
A list of values not available for selection.
| Type | array |
| Array values | boolean |
| Configurability | Read-only |
| Default | null |
emptyMessage
The message to display if no value is set.
| Type | string |
| Configurability | Inspector > Appearance > Empty state |
| Default | null |
events
A list of configured event handlers that trigger actions or queries.
| Type | array |
| Array values | object |
| Configurability | Inspector > Interaction > Event handlers |
| Default | null |
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 |
| Default | null |
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 |
| Default | null |
type
The type of action to perform.
| Type | string | ||||||||||||||
| Configurability | Inspector > Interaction > Event handlers > Edit event handler > Action | ||||||||||||||
| Allowed Values |
| ||||||||||||||
| Default | null |
Examples
falsequery1
falsebutton1
inputValue
The default or most recently entered value.
| Type | string |
| Configurability | Read-only |
| Default | null |
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 | false |
Examples
falsetrue
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 | true |
Examples
falsetrue
labelPosition
The position of the label relative to the input field or value.
| Type | string | |||||||||
| Format | Plain Text | |||||||||
| Configurability | Inspector > Content > Add-ons > Label > Position | |||||||||
| Allowed Values |
| |||||||||
| Default | left |
Examples
falsetop
loading
Whether to display a loading indicator.
| Type | boolean |
| Format | True/False |
| Configurability | Inspector > Interaction > Loading |
| Default | false |
Examples
falsetrue
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 | false |
Examples
falsetrue
margin
The amount of margin to render outside.
| Type | string | |||||||||
| Format | Plain Text | |||||||||
| Configurability | Inspector > Spacing > Margin | |||||||||
| Allowed Values |
| |||||||||
| Default | 4px 8px |
Examples
false4px 8px
overlayMaxHeight
The maximum height of the options list, in pixels.
| Type | number |
| Format | Integer |
| Configurability | Inspector > Appearance > Advanced > Max list height |
| Default | null |
Examples
false200
overlayMinWidth
The minimum width of the options list, in pixels.
| Type | number |
| Format | Integer |
| Configurability | Inspector > Appearance > Advanced > Min list width |
| Default | null |
Examples
false200
placeholder
The text to display within the input field when there is no value.
| Type | string |
| Format | string |
| Configurability | Inspector > Content > Placeholder |
| Default | Enter a value |
Examples
falseEnter a value
readOnly
Whether user input is read-only.
| Type | boolean |
| Format | True/False |
| Configurability | Inspector > Interaction > Advanced > Read only |
| Default | false |
Examples
falsetrue
required
Whether a value is required to be selected.
| Type | boolean |
| Format | True/False |
| Configurability | Inspector > Interaction > Validation rules > Required |
| Default | false |
Examples
falsetrue
searchMode
The type of search to perform.
| Type | string | ||||||||
| Configurability | Inspector | ||||||||
| Allowed Values |
| ||||||||
| Default | null |
selectedIndex
The selected values, by index.
| Type | number |
| Format | Integer |
| Configurability | Read-only |
| Default | [] |
Examples
false["Value 1", "Value 2"]
selectedItem
The selected item.
| Type | string | number | boolean | object | array |
| Format | Custom data |
| Configurability | Read-only |
| Default | null |
Examples
false{"id": "1", "name": "Item 1"}
selectedLabel
The label of the selected value, by index.
| Type | string |
| Format | string |
| Configurability | Read-only |
| Default | null |
Examples
falseValue 1
showClear
Whether to display a button to clear the value of the input field.
| Type | boolean |
| Format | True/False |
| Configurability | Inspector > Appearance > Show clear button |
| Default | false |
Examples
falsetrue
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 | false |
Examples
falsetrue
showSelectionIndicator
Whether to display an icon next to a selected item.
| Type | boolean |
| Format | True/False |
| Configurability | Inspector > Appearance > Advanced > Show selection indicator |
| Default | true |
Examples
falsetrue
tooltipText
The tooltip text to display next to the label on hover.
| Type | string |
| Format | Markdown |
| Configurability | Inspector > Content > Add-ons > Helper text |
| Default | null |
Examples
falseSubmit
value
The current value.
| Type | string | number | boolean | object | array |
| Configurability | Read-only |
| Default | null |
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
year.blur()
Examples
Remove focus from year.
year.blur();
year.clearValidation()
Examples
Clear the validation message from year.
year.clearValidation();
year.clearValue()
Examples
Clear the current value of year.
year.clearValue();
year.focus()
Examples
Set focus on year.
year.focus();
year.resetValue()
Examples
Reset the current value of year.
year.resetValue();
year.scrollIntoView()
Scrolls the canvas or parent container so that the selected component appears in the visible area.
year.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 year into view.
year.scrollIntoView({behavior: 'auto', block: 'nearest'});
year.setDisabled()
Set the disabled value to toggle whether the input field is disabled. Defaults to true without a parameter.
year.setDisabled(disabled)
Parameters
disabled
Whether input, interaction, selection, or triggering is disabled.
| Type | boolean |
| Format | True/False |
| Default | |
Examples
true
Examples
Disable year.
year.setDisabled(true);
Enable year.
year.setDisabled(false);
year.setHidden()
Set the hidden value to toggle whether the component is visible. Defaults to true without a parameter.
year.setHidden(hidden)
Parameters
Examples
true
Examples
Hide year.
year.setHidden(true);
Unhide year.
year.setHidden(false);
year.setValue(key, value)
Examples
Set the current value of year to userValue.
year.setValue(userValue);
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. |
| Input Value Change | The input value is changed. |