Coder Social home page Coder Social logo

tariqwest / material-ui-slider-label Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 2.0 104 KB

Adds value label to Material UI slider per Material design guidelines.

Home Page: https://material.io/guidelines/components/sliders.html#sliders-discrete-slider

License: MIT License

JavaScript 100.00%
material-design material-ui material-components material

material-ui-slider-label's People

Contributors

tariqwest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

shasthojoy bobgy

material-ui-slider-label's Issues

Crash "Cannot read property 'prepareStyles' of undefined"

Hello,
when I use this lib with @material-ui v3+, I have a crash (message in title of issue).

Slider.render
node_modules/material-ui-slider-label/Slider/Slider.js:719
  716 |     focused = _state.focused,
  717 |     hovered = _state.hovered,
  718 |     value = _state.value;
> 719 | var prepareStyles = this.context.muiTheme.prepareStyles;
  720 | 
  721 | var styles = getStyles(this.props, this.context, this.state);
  722 | var percent = getPercent(value, min, max);

The top part of stacktrace (in file Slider.js)

node_modules/material-ui-slider-label/Slider/Slider.js:719
node_modules/react-dom/cjs/react-dom.development.js:13538
node_modules/react-dom/cjs/react-dom.development.js:13501
node_modules/react-dom/cjs/react-dom.development.js:14090
node_modules/react-dom/cjs/react-dom.development.js:16416
...

My code:

import {createMuiTheme, MuiThemeProvider} from '@material-ui/core/styles';
// import Slider from '@material-ui/lab/Slider';
import Slider from 'material-ui-slider-label/Slider';
...
render(

            <MuiThemeProvider theme={ theme }>
                <Slider
                    min={0}
                    max={1}
                    value={ this.state.progress }
                    onChange={ this.handleChange }
                    label={
                        <div style={ classes.labelStyleOuter }>
                            <div style={ classes.labelStyleInner }>
                                {100}
                            </div>
                        </div>
                    }
                />
            </MuiThemeProvider>
);

Please publish it NPM registry

I am using your library, it is very helpful in labeling the slider. Could you please register this awesome library in NPM, so that I can use this in my project.

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.