JSPM

@chakra-ui/counter

0.0.0-dev-20220811093515
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 470290
  • Score
    100M100P100Q185153F
  • License MIT

A React hook for managing counters

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@chakra-ui/counter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Counter

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

    Installation

    yarn add @chakra-ui/counter
    
    # or
    
    npm i @chakra-ui/counter

    Import hook

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