1.0.2 • Published 3 years ago

@chakra-xui/counter v1.0.2

Weekly downloads
1
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 @chakra-xui/counter

# or

npm i @chakra-xui/counter

Import hook

import { useCounter } from "@chakra-xui/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>
  )
}