1.0.0-rc.9 • Published 3 years ago

@hackr/chakra-ui-counter v1.0.0-rc.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Counter

A React hook that provides simple and advance counter functionalities. Mostly used to create numeric inputs and countdown timers.

Installation

yarn add @hackr/chakra-ui-counter

# or

npm i @hackr/chakra-ui-counter

Import hook

import { useCounter } from "@hackr/chakra-ui-counter"

Basic usage

export function Example() {
  const counter = useCounter({
    max: 10,
    min: 0,
    step: 0.1,
  })

  return (
    <div>
      <button onClick={() => counter.increment()}>Increment</button>
      <p>{counter.value}</p>
      <button onClick={() => counter.decrement()}>Decrement</button>
    </div>
  )
}