useCounter

useCounter is a custom hook that returns the current counter value.

Count: 10

Usage

import { useCounter } from "@yamada-ui/react"
const { value, valueAsNumber, update, increment, decrement, reset, cast, out } =
  useCounter()

Set Default Value

To set a default value, pass a number or string to defaultValue.

Count: 10

Set Min And Max Values

To set minimum and maximum values, set min or max to a number.

Count: 5

Set Step Value

To set a step value, pass a number to step.

Count: 0

Count: 0

Specify Precision

To specify precision, pass a number to precision.

Count: 5.12

Allow Out Of Range Values

To allow out of range values, set keepWithinRange to false. The out property is also provided to indicate whether the value is out of range.

Count: 5

Cast Value

To cast value, use the cast function.