GithubHelp home page GithubHelp logo

mui-numpad's Introduction

⚠️ NOTE: This package is in very early stage of development. NOT recommended for production use yet.


numpad logo

MUI-NUMPAD

Numpad component for your React app.
View Demo · Report Bug · Request Feature · Ask a question


npm Maintenance GitHub package.json version

Table of Contents

Getting Started

mui-numpad is available as an npm package.

Installation

// with npm
npm install mui-numpad
// with yarn
yarn add mui-numpad

Usage

Simple numpad

import React, { useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Grid, TextField } from '@material-ui/core';

import MuiNumpad from 'mui-numpad';

const useStyles = makeStyles((theme) => ({
    gridItem: {
        display: 'flex',
        flexDirection: 'column',
        alignItems: 'center',
        justifyContent: 'center',
    },
    textField: {
        width: '100%',
    }
}));

function SimpleNumpad() {
    const classes = useStyles();
    const [value, setValue] = useState();

    const onChange = (_value) => {
        setValue(_value);
    }

    return (
        <Grid container spacing={2}>
            <Grid item className={classes.gridItem} xs={3}>
                <TextField 
                margin="dense"
                className={classes.textField}
                value={value}
                variant="outlined" />
            </Grid>
            <Grid item xs={3}>
                <MuiNumpad
                    onChange={onChange}
                />
            </Grid>
        </Grid>
    );
}

export default SimpleNumpad;

Props

Name Type Default Description
onChange func Callback fired when the value is changed.

function(value: string) => string value: The value that has been entered. Value is concatenated internally, so with each input you will be getting full value entered so far.
onKeyPress func Callback fired when the key is pressed.

function(value: string) => string value: The value of a button that has been pressed.

About The Project

Numpad component for your React app.

Built With

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Jasmin Mustafic

Gmail: [email protected]

Patreon: https://www.patreon.com/dotundefined

Linkedin: https://www.linkedin.com/in/jasmin-mustafic-126141151/

mui-numpad's People

Contributors

crux-coder avatar

Stargazers

 avatar  avatar

Watchers

 avatar

mui-numpad's Issues

multiple versions of "special" buttons

Currently in version 0.1.3-alpha, default "special" buttons are .(dot) on the left and C(clear) on the right.

We want to add couple of options here, for example:

  • enter/submit button
  • delete button - that deletes last number entered
  • leave out both of them if one desires
    etc.

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.