Skip to content

RangeField

A native slider with its current value displayed beside it. Input range attributes constrain the control, not programmatically supplied command values; enforce range rules on the command.

PropTypeDefaultDescription
value(instance: TCommand) => unknownRequired. Accessor function returning the property value from the command instance.
titlestringThe label for the field.
minnumber0Minimum value of the range.
maxnumber100Maximum value of the range.
stepnumber1Increment step size.
requiredbooleanOverride automatic required detection.

An undefined value uses a display fallback of zero. Seed a value within your chosen range rather than relying on the browser to reconcile an out-of-range command value. The form displays validation messages, but this control currently does not change its border for invalid state. See Common props for styling and population.

These illustrative field fragments require RangeField from @cratis/arc.react/commands and the named generated command classes. Place each inside its matching CommandForm, with numeric volume or experience properties. They are alternatives, not one complete component.

<RangeField<AudioCommand>
value={c => c.volume}
title="Volume"
min={0}
max={100}
step={1}
/>
<RangeField<UserCommand>
value={c => c.experience}
title="Years of Experience"
min={0}
max={50}
step={1}
/>