Skip to main content

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​

NameTypeDefaultDescription
source (required)string—Path to the range object in the form record
fields (required)FieldSchema[]—Must contain exactly the entries named lower and upper
labelstring | ReactElement | falselabel from the schemaLegend of the fieldset
helperTextstring | ReactElement | falsehelpText from the schemaText 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"}
]}
from django.contrib.postgres.fields import DecimalRangeField


class Product(models.Model):
price_range = DecimalRangeField(null=True, blank=True)

See also​