Percentage
The percentage
field in undb allows users to manage and display data as percentages. This field type is particularly useful for representing ratios, progress, or any data that is calculated as a fraction of 100. It provides an interactive interface using a slider to adjust values.
Key Features:
-
Slider Interface:
- The
percentage
field uses a slider for updating and displaying values. - Users can easily adjust the percentage by dragging the slider, providing an intuitive way to modify values in real-time.
- As the slider is moved, the percentage value is immediately updated and displayed in the user interface.
- The
-
Value Representation:
- Internally, the values are stored as decimal numbers (e.g.,
0.75
for75%
), but are displayed to the user as percentages (e.g.,75%
). - A range for the slider can be set, with typical boundaries being between
0%
and100%
, though custom ranges are supported.
- Internally, the values are stored as decimal numbers (e.g.,
-
Constraints:
- Minimum and Maximum Values: Users can define custom limits for the percentage range (e.g., between
10%
and90%
). - Step Precision: The slider can be configured to adjust in predefined increments (e.g.,
1%
,0.5%
), ensuring control over how finely the percentages can be adjusted.
- Minimum and Maximum Values: Users can define custom limits for the percentage range (e.g., between
-
Default Value:
- A default value can be configured for the
percentage
field, so when a new record is created, the slider will be set to this value unless overridden.
- A default value can be configured for the
-
Required Field:
- You can set the
percentage
field as required, ensuring that users must provide a value before creating or updating a record.
- You can set the
-
Validation:
- The system ensures that any percentage value entered or selected adheres to the defined constraints, preventing invalid entries.
Example Use Cases:
- Task Progress: Tracking task completion, where the slider represents the percentage of a task completed.
- Discount Rates: Managing dynamic discount rates in sales or pricing models.
- Performance Metrics: Visualizing performance statistics, such as success rates or efficiency, using the percentage slider.
Configuration Options:
- Range: Define the minimum and maximum values the slider can represent (e.g.,
0%
to100%
). - Step Precision: Set the increments for the slider (e.g., every
1%
or every0.5%
). - Default Value: Optionally set a default percentage value.
- Required: Indicate whether this field must be completed when submitting a record.
The percentage field in undb offers an efficient way to handle percentage-based data with an intuitive and visually clear interface using a slider.