React Scroller
Scroller for React
Scroller for React
Scroller for React
Scroller - Price Range
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
const fromValues = [];
let toValues = [];
for (let i = 0; i <= 1000; i += 20) {
fromValues.push({
display: '$' + i,
value: i
});
}
toValues = fromValues.slice();
toValues.shift();
toValues.push({
display: 'over $1000'
});
const wheels = [
[{
circular: false,
data: fromValues,
label: 'From'
}, {
circular: false,
data: toValues,
label: 'To'
}]
];
class App extends React.Component {
validate = (event, inst) => {
const values = event.values;
const disabledValues = [];
for (let i = 0; i < toValues.length; ++i) {
if (toValues[i].value <= values[0]) {
disabledValues.push(toValues[i].value);
}
}
return {
disabled: [
[], disabledValues
]
}
}
formatValue = (data) => {
return '$' + data[0] + ' - $' + data[1];
}
parseValue = (valueText) => {
if (valueText) {
return valueText.replace(/\s/gi, '').split('-');
}
return [0, 20];
}
render() {
return (
<mobiscroll.Form>
<mobiscroll.Scroller
display="inline"
type="hidden"
width={150}
wheels={wheels}
showLabel={true}
validate={this.validate}
formatValue={this.formatValue}
parseValue={this.parseValue}
placeholder="Please Select..."
/>
</mobiscroll.Form>
);
}
}
<div id="content">
Scroller - Custom Units
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
const units = ['oz', 'g', 'serving'];
let prevUnit = 'oz';
const wheel = [
[{
circular: false,
data: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
}, {
circular: false,
data: ['-', '1/4', '1/2', '3/4']
}, {
circular: false,
data: units
}]
];
class App extends React.Component {
validate = (event, inst) => {
let mult = 1;
const index = event.index;
const currUnit = event.values[2];
const disabled = [];
if (currUnit == 'g' && (prevUnit == 'oz' || prevUnit == 'serving')) {
mult = 28;
} else if ((currUnit != 'oz' || currUnit != 'serving') && prevUnit == 'g') {
mult = 1 / 28;
}
if (currUnit != 'serving') {
disabled.push('1/4', '1/2', '3/4');
}
if (index == 2 && currUnit != prevUnit) {
for (let i = 0; i < wheel[0][0].data.length; ++i) {
wheel[0][0].data[i] = Math.round(wheel[0][0].data[i] * mult);
}
inst.settings.wheels = wheel;
inst._tempWheelArray[0] = inst._tempWheelArray[0] * mult;
inst.changeWheel({
0: wheel[0][0]
});
prevUnit = currUnit;
}
return {
disabled: [
[], disabled, []
]
}
}
parseValue = (val) => {
let hasUnit = false;
if (val) {
val = val.toString().split(' ');
hasUnit = units.indexOf(val[1]) !== -1;
return [val[0], (hasUnit ? '' : val[1].replace('-', '')), (hasUnit ? val[1] : val[2])];
}
return [0, '-', 'oz'];
}
formatValue = (data) => {
return (data[2] == 'serving' && data[0] == 0 && data[1] ? '' : data[0]) + (data[1] ? ' ' + data[1].replace('-', '') : '') + ' ' + data[2];
}
render() {
return (
<div>
<mobiscroll.Scroller
display="inline"
type="hidden"
wheels={wheel}
validate={this.validate}
parseValue={this.parseValue}
formatValue={this.formatValue}
placeholder="Please Select..."
/>
</div>
);
}
}
<div id="content">
Scroller - Date range
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
const fromValues = ['Before 1960', 1970, 1980, 1990, 1995, 2000, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015];
const toValues = [1970, 1980, 1990, 1995, 2000, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016];
const wheels = [
[{
circular: false,
data: fromValues,
label: 'From'
}, {
circular: false,
data: toValues,
label: 'To'
}]
];
class App extends React.Component {
validate = (event, inst) => {
const values = event.values;
const disabledValues = [];
for (let i = 0; i < toValues.length; ++i) {
if (toValues[i] <= values[0]) {
disabledValues.push(toValues[i]);
}
}
return {
disabled: [
[], disabledValues
]
}
}
formatValue = (data) => {
return data[0] + ' - ' + data[1];
}
parseValue = (valueText) => {
if (valueText) {
return valueText.replace(/\s/gi, '').split('-');
}
return [1990, 2010];
}
render() {
return (
<div>
<mobiscroll.Scroller
display="inline"
type="hidden"
rows={12}
wheels={wheels}
showLabel={true}
minWidth={130}
validate={this.validate}
formatValue={this.formatValue}
parseValue={this.parseValue}
placeholder="Please Select..."
/>
</div>
);
}
}
<div id="content">
Scroller - Event handlers
EVENTS FIRED:
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
show = () => {
this.scroller.instance.show();
}
clear = () => {
this.scroller.instance.clear();
}
onInit = (event, inst) => {
// Your custom event handler goes here
}
onMarkupReady = (event, inst) => {
// Your custom event handler goes here
}
onBeforeShow = (event, inst) => {
// Your custom event handler goes here
}
onPosition = (event, inst) => {
// Your custom event handler goes here
}
onShow = (event, inst) => {
// Your custom event handler goes here
}
onSet = (event, inst) => {
// Your custom event handler goes here
}
onItemTap = (event, inst) => {
// Your custom event handler goes here
}
onDestroy = (event, inst) => {
// Your custom event handler goes here
}
onClose = (event, inst) => {
// Your custom event handler goes here
}
onCancel = (event, inst) => {
// Your custom event handler goes here
}
onBeforeClose = (event, inst) => {
// Your custom event handler goes here
}
onClear = (event, inst) => {
// Your custom event handler goes here
}
onChange = (event, inst) => {
// Your custom event handler goes here
}
validate = (data, inst) => {
// Your custom event handler goes here
}
setRef = (comp) => {
this.scroller = comp;
}
render() {
const wheels = [
[{
data: ['0', '1', '2', '3', '4', '5', '6', '7']
}, {
data: [{
value: 0,
display: 'a'
}, {
value: 1,
display: 'b'
}, {
value: 2,
display: 'c'
}, {
value: 3,
display: 'd'
}]
}]
];
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.Scroller
ref={this.setRef}
onInit={this.onInit}
onMarkupReady={this.onMarkupReady}
onBeforeShow={this.onBeforeShow}
onPosition={this.onPosition}
onShow={this.onShow}
onSet={this.onSet}
onItemTap={this.onItemTap}
onDestroy={this.onDestroy}
onClose={this.onClose}
onCancel={this.onCancel}
onBeforeClose={this.onBeforeClose}
onClear={this.onClear}
onChange={this.onChange}
validate={this.validate}
wheels={wheels}
placeholder="Please Select..."
placeholder="Please Select..."
>
<mobiscroll.Input inputStyle="box" labelStyle="stacked" placeholder="Please Select..." />
</mobiscroll.Scroller>
<div className="mbsc-btn-group">
<button type="button" onClick={this.clear}>Clear</button>
<button type="button" onClick={this.show}>Show</button>
</div>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Scroller - Display modes
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
const wheels = [
[{
label: 'First wheel',
data: ['0', '1', '2', '3', '4', '5', '6', '7']
}, {
label: 'Second wheel',
data: [{
value: 0,
display: 'a'
}, {
value: 1,
display: 'b'
}, {
value: 2,
display: 'c'
}, {
value: 3,
display: 'd'
}]
}]
];
class App extends React.Component {
render() {
return (
<mobiscroll.Form >
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Try different display modes</mobiscroll.FormGroupTitle>
<mobiscroll.Scroller display="bottom" wheels={wheels}>
<mobiscroll.Input placeholder="Please Select...">Bottom</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller display="top" wheels={wheels}>
<mobiscroll.Input placeholder="Please Select...">Top</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller display="center" wheels={wheels}>
<mobiscroll.Input placeholder="Please Select...">Center</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller display="bubble" wheels={wheels}>
<mobiscroll.Input placeholder="Please Select...">Bubble</mobiscroll.Input>
</mobiscroll.Scroller>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup className="mbsc-padding">
<p className="mbsc-thin">With inline display you can embed the Scroller component in almost any markup or form.</p>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Embedded scroller picker</mobiscroll.FormGroupTitle>
<mobiscroll.Scroller type="hidden" display="inline" wheels={wheels} />
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Scroller - Desktop
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
render() {
const wheelData = [
[{
data: ['0', '1', '2', '3', '4', '5', '6', '7']
}, {
data: [{
value: 0,
display: 'a'
}, {
value: 1,
display: 'b'
}, {
value: 2,
display: 'c'
}, {
value: 3,
display: 'd'
}]
}]
]
return (
<mobiscroll.Form>
<div className="mbsc-grid">
<div className="mbsc-row mbsc-justify-content-center">
<div className="mbsc-col-sm-9 mbsc-col-md-7 mbsc-col-xl-5">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Pop-up positioning</mobiscroll.FormGroupTitle>
<mobiscroll.Scroller display="bottom" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Bottom</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller display="top" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Top</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Anchored</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller display="center" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Center</mobiscroll.Input>
</mobiscroll.Scroller>
</mobiscroll.FormGroup>
</div>
</div>
<div className="mbsc-row mbsc-justify-content-center">
<div className="mbsc-col-sm-9 mbsc-col-md-7 mbsc-col-xl-5">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>With buttons</mobiscroll.FormGroupTitle>
<mobiscroll.Scroller display="center" touchUi={false} wheels={wheelData} buttons={['set']}>
<mobiscroll.Input placeholder="Please Select...">Set button</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller display="center" touchUi={false} wheels={wheelData} buttons={['set', 'cancel']}>
<mobiscroll.Input placeholder="Please Select...">Set/Cancel</mobiscroll.Input>
</mobiscroll.Scroller>
</mobiscroll.FormGroup>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Scroller - Theming capabilities
The look and feel of the scroller can be deeply customized. There are four levels of customization:
- Base themes: Choose between
Mobiscroll
,iOS
,Android Material
andWindows
. - Light or dark: Every theme has a
light
anddark
variant. Setting thethemeVariant
to'auto'
will switch based on system settings. - Custom themes: Use the theme builder to customize the colors and make it match your brand.
- Custom CSS: If you need further customization, the sky is the limit with CSS overrides.
You can also see how every example looks by changing the theme in the floating action bar on the right side.
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
render () {
var wheelData = [
[{
data: ['0', '1', '2', '3', '4', '5', '6', '7']
}, {
data: [{
value: 0,
display: 'a'
}, {
value: 1,
display: 'b'
}, {
value: 2,
display: 'c'
}, {
value: 3,
display: 'd'
}]
}]
]
return (
<mobiscroll.Form>
<div className="mbsc-grid mbsc-grid-fixed">
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>iOS Theme</mobiscroll.FormGroupTitle>
<mobiscroll.Scroller theme="ios" themeVariant="light" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Light</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller theme="ios" themeVariant="dark" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Dark</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller theme="ios-gray" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Custom</mobiscroll.Input>
</mobiscroll.Scroller>
</mobiscroll.FormGroup>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Material Theme</mobiscroll.FormGroupTitle>
<mobiscroll.Scroller theme="material" themeVariant="light" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Light</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller theme="material" themeVariant="dark" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Dark</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller theme="material-indigo" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Custom</mobiscroll.Input>
</mobiscroll.Scroller>
</mobiscroll.FormGroup>
</div>
</div>
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Windows Theme</mobiscroll.FormGroupTitle>
<mobiscroll.Scroller theme="windows" themeVariant="light" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Light</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller theme="windows" themeVariant="dark" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Dark</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller theme="windows-yellow" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Custom</mobiscroll.Input>
</mobiscroll.Scroller>
</mobiscroll.FormGroup>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Mobiscroll Theme</mobiscroll.FormGroupTitle>
<mobiscroll.Scroller theme="mobiscroll" themeVariant="light" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Light</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller theme="mobiscroll" themeVariant="dark" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Dark</mobiscroll.Input>
</mobiscroll.Scroller>
<mobiscroll.Scroller theme="mobiscroll-lime" display="bubble" touchUi={false} wheels={wheelData}>
<mobiscroll.Input placeholder="Please Select...">Custom</mobiscroll.Input>
</mobiscroll.Scroller>
</mobiscroll.FormGroup>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Looking for something you didn't see or have a sales question?
Ask us about it, we're here to help.
Component license
Purchase component licenses if you are looking for specific funcionality.
All
Framework license
Get all 36 components, including
Framework license
Get all 36 components, including
- Use it when building with plain and simple JS
- Compatible with vanilla JS app or frameworks like Vue
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with jQuery and jQuery Mobile
- Enjoy the familiar API if you already use jQuery
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with Angular JS and Ionic 1
- For web and mobile apps based on Angular 1.x
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with Angular and Ionic 2/3/4
- Visual Studio and VS Code integration
- Royalty-free commercial usage
- Technical support is included with the license
- Use it when building with React JS
- Collection of UI components for web and mobile
- Royalty-free commercial usage
- Technical support is included with the license
Framework license
Select the development framework you are using. Get all 36 components with the license.
- Use it when building with plain and simple JS
- Compatible with vanilla JS app or frameworks like Vue
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with jQuery and jQuery Mobile
- Enjoy the familiar API if you already use jQuery
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with Angular JS and Ionic 1
- For web and mobile apps based on Angular 1.x
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with Angular and Ionic 2/3/4
- Visual Studio and VS Code integration
- Royalty-free commercial usage
- Technical support is included with the license
- Use it when building with React JS
- Collection of UI components for web and mobile
- Royalty-free commercial usage
- Technical support is included with the license
Select the framework you are interested in
Use Javascript when building with plain and simple JS.
Use jQuery when you have jQuery already included or if you are building with jQuery Mobile.
Use AngularJS when building with Angular 1.x or Ionic 1.
Use Angular when building with Angular 2/4/5/6/7/8 or Ionic 2/3/4.
Use it when you are building your app or website with React.
Do you need additional support seats?
The license comes with one support seat. ( +$100/seat )
Add the source code?
What framework are you using?
We have to set you up with a trial for this to run 👍
Step 1.Install the Mobiscroll CLI from npm
$ npm install -g @mobiscroll/cli
The CLI makes configuring your apps super simple 👍
Step 2.Run the following command in the root folder of your Ionic project
$ mobiscroll config ionic
$ mobiscroll config ionic --lite
You will be prompted to log in with your mobiscroll account. Set your password here
Create an Ionic 3 & Mobiscroll starter with the CLI:
Run this command for Ionic 4 & Mobiscroll starter:
Step 3.Copy the code into your app.
Step 4.Run ionic serve in the root folder of your app 🎉
$ ionic serve
And voilà, everything should be running smoothly.
Step 1.Install the Mobiscroll CLI from npm
$ npm install -g @mobiscroll/cli
The CLI makes configuring your apps super simple 👍
Step 2.Run the following command in the root folder of your Angular project
$ mobiscroll config angular
$ mobiscroll config angular --lite
You will be prompted to log in with your mobiscroll account. Set your password here
Step 3.Copy the code into your app. HTML goes into the markup, TS into Typescript.
Step 4.Run ng serve in the root folder of your app 🎉
$ ng serve
And voilà, everything should be running smoothly.
Extract the zip file and run the project like any Ionic app. Make sure to have Ionic CLI installed and open the terminal in the app root folder.
$ npm install
$ ionic serve
Let us know if we can help and enjoy!
Your password has been changed!
Everything is set up so that you can dig in right away and start exploring.
We have set up a trial so that you can try the demos locally.
Extract the zip file and open the demo in your favorite browser.
To install Mobiscroll in your project
follow instructions from this page.
Let us know if we can help and enjoy! 👍
Please extract the zip file and run the project like any Angular CLI app.
Make sure to have the Angular CLI installed.
For installation and usage, extract the zip file and open a terminal window and follow these steps.
$ npm install
$ ng serve --open
Let us know if we can help and enjoy! 👍
Everything is set up so that you can dig in right away and start exploring.
We have set up a trial so that you can try the demos locally.
The easiest way to get started is to follow the installation steps and by
grabbing the code directly from the demo page. Let us know if we can help and enjoy!
You'll find a fully functional Kitchen-sink Ionic app in the zip file.
Everything is set up so that you can dig in right away and start exploring.
We have set up a trial so that you can try the demos locally.
The demos are using Babel's in-browser ES6 and JSX transformer.
Extract the zip file and open the demo in your browser. To install Mobiscroll in your project
follow instructions from this page.
Let us know if we can help and enjoy! 👍