The Percent component for Retool Apps
An input field to enter a percentage number value.
Percent is a preset version of Number Input. It has been preconfigured with common options for percentage input.
For more information about using the Percent component, refer to the number inputs 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.
allowNull
Whether to allow and validate a null
value instead of 0
if the input field is empty.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
currency
A three-letter ISO currency code to use if format
is currency
.
Type | string | ||||
Mutability |
|
decimalPlaces
The number of decimal places to display. If necessary, values round up or down automatically.
Type | number | ||||
Format | Integer | ||||
Mutability |
|
disabled
Whether input, interaction, selection, or triggering is disabled.
Type | boolean | ||||||
Format | True/False | ||||||
Mutability |
| ||||||
Default |
|
Examples
true
format
The formatting style to use.
Type | string | ||||||||
Mutability |
| ||||||||
Allowed Values |
|
iconAfter
The suffix icon to display.
Type | string | ||||
Format | Icon Key | ||||
Mutability |
| ||||
Default |
|
Examples
/icon:bold/shopping-gift
iconBefore
The prefix icon to display.
Type | string | ||||
Format | Icon Key | ||||
Mutability |
| ||||
Default |
|
Examples
/icon:bold/shopping-gift
id
The unique identifier (name).
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
query1
button1
inputTooltip
The tooltip helper text to display below the input on focus.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
`Shift+Enter` to save, `Esc` to cancel
isHiddenOnDesktop
Whether to show or hide this object in the desktop layout.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
isHiddenOnMobile
Whether to show or hide this object in the mobile layout.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
labelPosition
The position of the label relative to the input field or value.
Type | string | |||||||||
Format | Plain Text | |||||||||
Mutability |
| |||||||||
Allowed Values |
| |||||||||
Default |
|
Examples
top
loading
Whether to display a loading indicator.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
maintainSpaceWhenHidden
Whether to take up space on the canvas if hidden
is true
.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
margin
The amount of margin to render outside.
Type | string | |||||||||
Format | Plain Text | |||||||||
Mutability |
| |||||||||
Allowed Values |
| |||||||||
Default |
|
Examples
4px 8px
max
The maximum value to allow.
Type | number | ||||
Mutability |
|
min
The minimum value to allow.
Type | number | ||||
Mutability |
|
padDecimal
Whether to include trailing zeros to match the specified value for decimalPlaces
.
Type | boolean | ||||
Mutability |
|
placeholder
The text to display within the input field when there is no value.
Type | string | ||||
Format | string | ||||
Mutability |
| ||||
Default |
|
Examples
Enter a value
readOnly
Whether user input is read-only.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
required
Whether a value is required to be selected.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
showClear
Whether to display a button to clear the value of the input field.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
showInEditor
Whether the component remains visible in the editor if hidden
is true
.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
showSeparators
Whether the formatted value includes a localized thousands separator.
Type | boolean | ||||
Mutability |
|
showStepper
Whether the input field includes buttons to adjust the value incrementally.
Type | boolean | ||||
Mutability |
|
style
Custom style options.
Type | object | ||||
Mutability |
|
textAfter
The suffix text to display.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
USD
px
@example.com
textAlign
The alignment of the text within the input field.
Type | string | ||||||||
Mutability | Read-only | ||||||||
Allowed Values |
|
textBefore
The prefix text to display.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
$
Email address
SKU
tooltipText
The tooltip text to display next to the label on hover.
Type | string | ||||
Format | Markdown | ||||
Mutability |
| ||||
Default |
|
Examples
Submit
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
percent.clearValidation()
Examples
Clear the validation message from percent
.
percent.clearValidation();
percent.clearValue()
Examples
Clear the current value of percent
.
percent.clearValue();
percent.focus()
Examples
Set focus on percent
.
percent.focus();
percent.resetValue()
Examples
Reset the current value of percent
.
percent.resetValue();
percent.scrollIntoView()
Scrolls the canvas or parent container so that the selected component appears in the visible area.
percent.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 percent
into view.
percent.scrollIntoView({behavior: 'auto', block: 'nearest'});
percent.setHidden()
Set the hidden
value to toggle whether the component is visible. Defaults to true
without a parameter.
percent.setHidden(hidden)
Parameters
Examples
true
Examples
Hide percent
.
percent.setHidden(true);
Unhide percent
.
percent.setHidden(false);
percent.setValue(value)
Examples
Set the current value of percent
to userValue
.
percent.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. |
Submit | The value is submitted. |