Giter VIP home page Giter VIP logo

react-doge-numpad's Introduction

react-doge-numpad

Wow! Such component! Very react! So numpad!

doge

This react component is created by a DOGE lover. No it's nth related to the component itself. I just want to share my love to DOGE to all of you.

This is NOT a joke, this is NOT an assignment of a course. This is a working react component.

screenshot

This is a Numpad component. I build this becoz I want a react numpad component so badly but MOST of the react numpad components available in the npmjs are apparently some assignments of some programming courses. I give up and I have to build one for myself. And now I want to share it to you all.

NPM Downloads Downloads

Install

npm install --save react-doge-numpad

Usage

import React, { useState } from 'react'

import Numpad from 'react-doge-numpad'
import 'react-doge-numpad/dist/index.css'

const App = () => {
  const [value, setValue] = useState("");

  return (
    <Numpad
      label="Label"
      value={0}
      decimal={true}
      max={1000000000000}
      min={0}
      onChange={(value: number | string) => setValue(`${value}`)}>
      <input type="text" value={value} />
    </Numpad>
  );
}

Parameters

Name Type Default Description
inline boolean true By default Numpad is a popup. Setting inline to be true will render the component inline instead of a popup
label string "" Title of the Numpad
value number 0 Default value shown on the Numpad
decimal boolean true Indicate whether the Numpad support decimal
max number 1000000000000 Upper bound of the number
min number 0 Lower bound of the number
onChange (value: number/string) => void () => false Callback for handling event when user press Enter
renderValue (value: number/string) => string (value) => String(value) Custom function for render/format the number (e.g. currency formating)
children JSXElement null Children are required if inline is set to false, meaning the Numpad is shown as a popup. To enable the Numpad user needs to click or press keys on the children element(s). It can be a <input>, a <button>, or whatever React components.

License

MIT © ShawTim

react-doge-numpad's People

Contributors

shawtim avatar

Stargazers

 avatar

Watchers

 avatar

react-doge-numpad's Issues

Remove material-ui dependency

the dependency is fat and heavy. it doesnt worth to add a peer dependency of material-ui just becoz the component needs a popup overlay and a Card component.

suggestion:

  • pick an alternative that is much smaller in size and tiny;
  • build one - it's just a popup overlay and a Card.

component documentation needed

literally there is no documentation for the usage but just an example.

at least need a documentation with:

  • what props it's supporting
  • how does it work? e.g. what's the effect for enclosing other components as the children?
  • customization?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.