Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Stepper Pattern

Stepper is a hypermedia control that presents a small-range value, such as item quantity or meeting duration, and offers affordances to increment and decrement that value. The Stepper pattern has a Stepper resource that contains the value to modify. Two Action resources increment or decrement the value when they are triggered. These return a location header pointing back to the modified Stepper resource.

The increment and decrement links are present when the value can be modified, and absent when not. For instance, a cart line-item quantity stepper may not allow stepping below 1, or above the inventory count for that item. If the quantity is already 1, then the decrement link will be omitted. If the quantity is at its maximum value, then the increment link will be omitted.

Stepper Resource

profile: <https://level3.rest/patterns/stepper#stepper-resource>

A Data resource that contains the value being incremented and decremented. This value can be a field in the data object, or it can be a single value. A Stepper resource can have multiple Incrementers and Decrementers, one per field. The links may contain an anchor property indicating the field to be stepped.

increment

rel="https://level3.rest/patterns/stepper#increment";anchor="#field-path"

Points to an Incrementer resource that increases the value of the Stepper resource by a single step. This relationship only appears if the value can be incremented, meaning the value has no range or it is below its maximum value. If present, the anchor property contains a field path to the property being incremented.

decrement

rel="https://level3.rest/patterns/stepper#decrement";anchor="#field-path"

Points to a Decrementer resource that decreases the value of the Stepper resource by a single step. This relationship only appears if the value can be incremented, meaning it is no range or it is above its minimum value. If present, the anchor property contains a field path to the property being decremented.

Incrementer Resource

profile: <https://level3.rest/patterns/stepper#incrementer-resource>

An Action resource that increments the value (or field) of the Stepper resource by a single step. If the value is already at its maximum, POST to this resource is ignored.

increments

rel="https://level3.rest/patterns/stepper#increments";anchor="#field-path"

Points to the Stepper resource that will be incremented. The anchor value in the link contains a path to the field being incremented, if relevant.

Decrementer Resource

profile: <https://level3.rest/patterns/stepper#decrementer-resource>

An Action resource that decrements the value (or field) of the Stepper resource by a single step. If the value is already at its minimum, POST to this resource is ignored.

decrements

rel="https://level3.rest/patterns/stepper#decrements";anchor="#field-path"

Points to the Stepper resource that will be decremented. The anchor value in the link contains a path to the field being incremented, if relevant.

Specifications

Web Link Context (anchor): RFC 8288, section 3.2


© 2019-2023 Matt Bishop
Creative Commons Licence
This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.