Form

Counter

Numeric input with increment/decrement controls.

Available inreactangular

Preview

Live previewreal component
Max tool results

Install

TerminalBash
npx mcp-elements add counter

Usage

counter-example.tsxTSX
import { useState } from 'react'
import { Counter } from '@mcp-elements/react'

export function Example() {
  const [value, setValue] = useState(4)
  return <Counter value={value} onChange={setValue} min={1} max={20} />
}

Props

PropTypeDefaultDescription
value *numberCurrent numeric value (controlled)
onChange *(value: number) => voidCalled with the next value when incremented, decremented, or typed
minnumber0Minimum allowed value
maxnumber99Maximum allowed value
stepnumber1Amount added or removed per increment/decrement
disabledbooleanfalseWhether the counter is disabled
classNamestringAdditional CSS classes