Skip to content
Velkin LogoVelkin Logo
Velkin
VELKIN/UI

Modern UI components for product teams and their AI agents. Lit core, typed wrappers, live MCP.

sales@velkinui.com

Product

  • Docs
  • Components
  • Studio
  • Pricing

Resources

  • Quick start
  • Blog
  • Changelog
  • Roadmap
  • Status

Project

  • About
  • Contact
  • License
  • Privacy
  • Terms

© 2026 Velkin. MIT core · Pro licenses available.

VELKIN

Counter

A counter component for numeric input with label, hint, and validation.

vu-counter · @velkin/react/counter

Copy page

Import

React
npm i @velkin/react

import { VuCounter } from "@velkin/react/counter";

Examples

API

Props

PropTypeDefaultDescription
namestring—Form field name for submit (`name` attr).
defaultvaluestring—Restored on `<form reset>`; falls back to `defaultnumber` (`defaultvalue` attr).
formidstring—External `<form>` id (`formid` attr).
disabledboolean—Non-interactive; blocks stepping and typing (`disabled` attr).
readonlyboolean—Focusable but cannot change value (`readonly` attr).
requiredboolean—Blocks valid submit when empty (`required` attr).
requiredmessagestring—Custom `valueMissing` message (`requiredmessage` attr).
labelstring""Plain-text label; slotted `label` wins when assigned.
hintstring""Helper text; `hint` slot wins when assigned.
idstring""Host id forwarded to the internal input.
valuenumber0Current value; `NaN` when empty with `allowempty`. Default: `0`.
variantVuCounterVariant"default"Field chrome recipe. Default: `"default"`.
toneVuCounterTone"normal"Neutral surface weight. Default: `"normal"`.
sizeVuCounterSize"md"Control scale. Default: `"md"`.
radiusVuCounterRadius"md"Corner preset (`none`/`sm`/`md`/`lg`/`full`). Default: `md`.
blockbooleanfalseStretches the stepper to the container width. Default: `false`.
compactbooleanfalseTighter label/hint/error spacing. Default: `false`.
minnumber0Minimum allowed value. Default: `0`.
maxnumber—Optional maximum allowed value.
stepnumber1Increment/decrement step size. Default: `1`.
allowtypingboolean—Enables direct typing in the number input. Default: `false`.
allowemptyboolean—Permits an empty field (`NaN`) until blur when typing. Default: `false`.
wrapbooleanfalseAt bounds, step wraps to the opposite bound. Default: `false`.
commitonlyboolean—Typing emits `vu-change` on blur only; buttons emit immediately. Default: `false`.
precisionnumber0Decimal places applied on blur and programmatic sets. Default: `0`.
placeholderstring""Shown when the value is empty (`NaN`).
showerrorsboolean—Shows validation after activation (`showerrors` attr). Default: `false`.
validationactiveboolean—Drives invalid styling after activation (`validationactive` attr). Default: `false`.
invalidbooleanfalseTrue when last validation found errors (`invalid` attr). Default: `false`.
icondecreasestring—Iconify id for the decrease button.
iconincreasestring—Iconify id for the increase button.
defaultnumbernumber—Baseline for `reset()` when `defaultvalue` is unset. Default: `0`.
decreaselabelstring—Accessible name for the decrease button.
increaselabelstring—Accessible name for the increase button.
arialabelstring—Input name when no visible label is present.
holddelaynumber—ms before press-and-hold repeat starts. Default: `400`.
holdintervalnumber—ms between repeats while held. Default: `80`.
holdaccelerateboolean—Halves repeat interval after sustained hold. Default: `true`.
allowTypingbooleanfalseEnables direct typing in the number input.
allowEmptybooleanfalsePermits an empty field (`NaN`) until blur when typing.
commitOnlybooleanfalseTyping emits `vu-change` on blur only; buttons emit immediately.
showErrorsbooleanfalseShows validation after activation.
iconDecrease"ion:remove""ion:remove"Iconify id for the decrease button.
iconIncrease"ion:add""ion:add"Iconify id for the increase button.
defaultNumbernumber0Baseline for `reset()` when `defaultvalue` is unset.
decreaseLabelstring""Accessible name for the decrease button.
increaseLabelstring""Accessible name for the increase button.
ariaLabelstring""Input name when no visible label is present.
holdDelaynumber400ms before press-and-hold repeat starts.
holdIntervalnumber80ms between repeats while held.
holdAcceleratebooleantrueHalves repeat interval after sustained hold.
validationActivebooleanfalseDrives invalid styling after activation.

Events

EventDetailDescription
vu-changeVuCounterChangeDetailValue updates (`detail.previous`, `detail.reason`).
vu-clearVuCounterClearDetailAfter `reset()` syncs the default value.
vu-invalidVuCounterInvalidDetailWhen validation messages are recomputed.

Slots

SlotDescription
labelRich label markup; takes precedence over string `label` when assigned.
hintOptional helper copy (HTML); overrides string `hint` when assigned.
errorReplaces default validation message list when assigned.
startLeading unit or symbol inside the field container.
endTrailing unit or symbol inside the field container.

CSS parts

PartDescription
fieldColumn stacking label, control row, hint, and error.
labelLabel element wired to the input.
startLeading affix wrapper.
endTrailing affix wrapper.
containerStepper chrome (buttons + input).
buttonShared part on decrease and increase buttons.
button--decreaseDecrease button.
button--increaseIncrease button.
iconShared part on decrease and increase icons.
icon--decreaseDecrease icon.
icon--increaseIncrease icon.
inputNumeric input field.
hintHelper text region.
error-messageValidation error region.
error-lineOne default validation string.

Methods

MethodDescription
increment- Increases value by `step`.
decrement- Decreases value by `step`.
setValue- Sets value after clamp/snap and emits `vu-change`.
reset- Restores baseline value and dispatches `vu-clear`.
validateInput- Recomputes validation messages and syncs validity.

Types

NameDefinition
VuCounterChangeDetail
{
  value: number;
  previous: number;
  reason: VuCounterChangeReason;
}
VuCounterClearDetail
{ value: number; }
VuCounterInvalidDetail
{ errors: string[]; }
VuCounterRadius
"sm" | "md" | "lg" | "none" | "full"
VuCounterSize
"sm" | "md" | "lg"
VuCounterTone
"subtle" | "normal" | "strong"
VuCounterVariant
"outline" | "default" | "underline"

Related

Inputs

  • Advanced FilterAn advanced filter component with expression input and visual builder.
  • ButtonA clickable button component with multiple variants and states.
  • Button GroupA button group component with shared styling and optional selection.
  • CheckboxA checkbox component with label, hint, and validation.
  • Checkbox GroupA checkbox group component with shared label and validation.
  • Color AreaA two-dimensional color picker component for saturation and brightness.

Guides

  • FormsFormData, VuForm, and validation
  • EventsonVu* / v-model / e.detail
  • Appearancevariant, color, tone, size

Browse

  • Previous: ComboboxEarlier in the sidebar
  • Next: Date PickerLater in the sidebar
  • All componentsBrowse the full index