Skip to content

Commit

Permalink
Merge pull request #2371 from lifeiscontent/patch-1
Browse files Browse the repository at this point in the history
Update Number.js
  • Loading branch information
Hypnosphi committed Nov 26, 2017
2 parents 553bccd + 652f862 commit ce69ca8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions addons/knobs/src/components/types/Number.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class NumberType extends React.Component {
style={styles}
value={knob.value}
type="number"
min={knob.min}
max={knob.max}
step={knob.step}
onChange={() => onChange(parseFloat(this.input.value))}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions examples/cra-kitchen-sink/src/stories/addon-knobs.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ storiesOf('Addon Knobs.withKnobs', module)
cherry: 'Cherry',
};
const fruit = select('Fruit', fruits, 'apple');
const dollars = number('Dollars', 12.5);
const dollars = number('Dollars', 12.5, { min: 0, max: 100, step: 0.01 });

const backgroundColor = color('background', '#ffff00');
const items = array('Items', ['Laptop', 'Book', 'Whiskey']);
Expand Down Expand Up @@ -111,7 +111,7 @@ storiesOf('Addon Knobs.withKnobsOptions', module)
cherry: 'Cherry',
};
const fruit = select('Fruit', fruits, 'apple');
const dollars = number('Dollars', 12.5);
const dollars = number('Dollars', 12.5, { min: 0, max: 100, step: 0.01 });

const backgroundColor = color('background', '#ffff00');
const items = array('Items', ['Laptop', 'Book', 'Whiskey']);
Expand Down

0 comments on commit ce69ca8

Please sign in to comment.