Skip to content

Stepper

A component used to input or adjust numbers, supporting custom steps, precision, formatting, and different layouts.

Component Features

  • 🔢 Numeric Control: Supports custom min, max, step, and precision values.
  • 🎨 Various Layouts: Control buttons can be placed on both sides, on the right, or configured to show buttons only.
  • 🔤 Formatting: Supports custom value formatting and parsing (e.g., currency format).
  • 📏 Multiple Sizes: Available in small, medium, and large sizes.
  • 🖱️ Long Press: Supports long-pressing buttons for continuous increment/decrement.
  • 📋 Form Integration: Integrates seamlessly with BrForm, supporting validation states.

Basic Usage

The most basic stepper, binding the value via v-model.

Current Value: 1
Example

Precision and Step

Use the step prop to set the step value and the precision prop to set decimal precision.

Current Value: 0.5
Example

Formatting

You can customize how the value is displayed in the input using the formatter and parser props.

Example

Controls Position and Mode

Use controls-position to change the position of the buttons, and button-only to hide the input field and keep only the control buttons.

5
Example

Size

Supports three different sizes: sm, md, and lg.

xs (Extra Small Size)
sm (Small Size)
md (Medium Size,Default)
lg (Large Size)
xl (Extra Large Size)
2xl (Massive Size)
Example

Form Integration

A typical application within forms, supporting validation states and disabled states in conjunction with BrFormItem.

Example

Theme Customization

Combined with BrConfigProvider, you can globally override the component's default styles. Local styles can also be overridden via TailwindCSS.

Example

API Reference

BrStepper

PropTypeDefaultDescription
modelValue / v-modelnumber | null-Binding value
defaultValuenumber | null-Default value (uncontrolled mode)
minnumberNumber.MIN_SAFE_INTEGERMinimum value
maxnumberNumber.MAX_SAFE_INTEGERMaximum value
stepnumber1Step value for each change
precisionnumber-Numeric precision
disabledbooleanfalseWhether it is disabled
readonlybooleanfalseWhether it is readonly
size'sm' | 'md' | 'lg''md'Size of the stepper
formatter(value: number | null) => string-Format function for the input display
parser(value: string) => number | null-Parse function to extract number from input
debounceDelaynumber300Input debounce delay in ms
longPressbooleantrueEnable continuous changes via long press
buttonOnlybooleanfalseWhether to show buttons only (hide input)
controlsPosition'both' | 'right''both'Position of the control buttons
placeholderstring-Placeholder text

Events

Event NameDescriptionCallback Parameters
update:modelValueTriggered when the binding value changes(value: number | null)
changeTriggered when the binding value changes(value: number | null)
blurTriggered when the input loses focus(event: FocusEvent)
focusTriggered when the input gets focus(event: FocusEvent)