mui-numpad

0.1.4-alpha • Public • Published

⚠️ 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: mustaficjasmin7@gmail.com

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

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

Package Sidebar

Install

npm i mui-numpad

Weekly Downloads

4

Version

0.1.4-alpha

License

MIT

Unpacked Size

15.2 kB

Total Files

5

Last publish

Collaborators

  • dotundefined