SchemaRangeInput
Collects a lower and an upper bound side by side inside one fieldset.
Each bound is a nested SchemaInput, so a numeric range gets number inputs and a datetime range gets pickers. When both bounds are plain dates the dispatcher prefers DateRangeInput, which is friendlier for filtering.
Example
<SchemaRangeInput source="price_range" fields={priceRangeSchema.properties} />
Props
| Name | Type | Default | Description |
|---|---|---|---|
source (required) | string | — | Path to the range object in the form record |
fields (required) | FieldSchema[] | — | Must contain exactly the entries named lower and upper |
label | string | ReactElement | false | label from the schema | Legend of the fieldset |
helperText | string | ReactElement | false | helpText from the schema | Text under the fieldset; a validation error replaces it |
Either bound may be left empty, so an open-ended range submits without the user touching the other side.
caution
The component throws when fields lacks a lower or an upper entry — a range field's schema
must expose both as properties.
Schema mapping
type: "object" with format: "range" and two properties:
{"name": "price_range", "type": "object", "format": "range",
"properties": [
{"name": "lower", "type": "number"},
{"name": "upper", "type": "number"}
]}
- Python
- Ruby
from django.contrib.postgres.fields import DecimalRangeField
class Product(models.Model):
price_range = DecimalRangeField(null=True, blank=True)
See also
- SchemaRangeField — the display counterpart
- DateRangeInput — the calendar variant for date ranges