Skip to content

Stepper

A simple input component that allows users to increment or decrement a numeric value using the provided buttons.

Importing

To use the stepper component, first you need to register the component inside the page. You can register the component manually by importing the register function:

ts
import { register } from "@tapsioss/web-components/stepper";

register(); // Now the stepper component is ready to use!
ts
import { registerStepper } from "@tapsioss/web-components";

registerStepper(); // Now the stepper component is ready to use!

Also you can automatically register the component by importing it with the following approach:

ts
import "@tapsioss/web-components/stepper/element";

TIP

If you want to use all the component in your app, you can call registerAll at the root of your project.

ts
import { registerAll } from "@tapsioss/web-components";

registerAll(); // All the components are now available

In the React package, you can easily add the component using the following code:

ts
import { Stepper } from "@tapsioss/react-components";

Component Usage

html
<tapsi-stepper></tapsi-stepper>
tsx
<Stepper />

Properties

NameAttribute NameDescriptionTypeDefault Value
unitunitThe unit of the value.string""
sizesizeThe size of the input."sm" | "md""md"
value-The current value of the input.string"0"
valueTextvaluetextDefines the human-readable text alternative of value.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext
string""
labellabelDefines a string value that can be used to name input.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label
string""
labelledBylabelledbyIdentifies the element (or elements) that labels the input.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby
string""
readOnlyreadonlyIndicates whether a user should be able to edit the input's value.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonly
booleanfalse
maxmaxDefines the maximum value in the range of permitted values.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#max
stringDEFAULT_MAX
minminDefines the minimum value in the range of permitted values.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#min
stringDEFAULT_MIN
stepstepReturns or sets the element's step attribute, which works with min and max
to limit the increments/decrements at which the input value can be set.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step
string"1"
autofocusautofocusIndicates that the element should be focused on page load.

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
booleanfalse
valueAsNumber-The input's value as a number.number0

Methods

NameDescriptionParameters
stepDownDecrements the value of the input.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/stepDown
Name: stepDecrement
Type: (number): The number of steps to decrement.
stepUpIncrements the value of the input.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/stepUp
Name: stepIncrement
Type: (number): The number of steps to increment.

Events

NameDescriptionTypeBubblesCancelable
changeFires when value changes.Event

Created with 🧡