React Range
Range for React
Range for React
Range for React
Learn more
A goto solution for picking date and time ranges. Date-only, time-only or mixed date & time modes are supported. You can use it with one or two inputs for start and end range.
Can be used as a component along with other mobiscroll form elements or as a directive on any input or field.
Shipping with useful features for a great UX, including:
- Usage on mobile and desktop with responsive features
- Date, time or date & time ranges
- Calendar view or scroller controls
- Usage on mobile and desktop with responsive features
- Validation with disabled dates, min & max for restricting selection
- Marked, colored days and day labels
- Variable week view
- Multiple month view
- Week counter
- Fullscreen, modal, popup and inline display support
- RTL Support
- Full localization
Interested in date and/or time selection? Other demos that could be useful:
Date & Time Range demos available for other frameworks.
Viewing demos & code for
Range - Date range
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
constructor(props) {
super(props);
const now = new Date();
const week = [now, new Date(now.getFullYear(), now.getMonth(), now.getDate() + 6, 23, 59)];
this.state = {
val: week
};
}
show = () => {
this.external.instance.show();
}
setExternal = (comp) => {
this.external = comp;
}
render () {
return (
<div>
<mobiscroll.Form>
<div className="mbsc-align-center">
<div className="mbsc-note mbsc-note-primary">The range can be used inside a mobiscroll form or on any input.</div>
</div>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Two inputs inside Mobiscroll Form</mobiscroll.FormGroupTitle>
<mobiscroll.Range>
<mobiscroll.RangeStart>
<mobiscroll.Input placeholder="Please Select ...">From</mobiscroll.Input>
</mobiscroll.RangeStart>
<mobiscroll.RangeEnd>
<mobiscroll.Input placeholder="Please Select ...">Until</mobiscroll.Input>
</mobiscroll.RangeEnd>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Date scroller</mobiscroll.FormGroupTitle>
<mobiscroll.Range controls={['date']}>
<mobiscroll.RangeStart>
<mobiscroll.Input placeholder="Please Select ...">From</mobiscroll.Input>
</mobiscroll.RangeStart>
<mobiscroll.RangeEnd>
<mobiscroll.Input placeholder="Please Select ...">Until</mobiscroll.Input>
</mobiscroll.RangeEnd>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup className="mbsc-padding">
<p className="mbsc-thin">Use it on any input or non-mobiscroll form.</p>
</mobiscroll.FormGroup>
</mobiscroll.Form>
<div className="demo-container">
<label htmlFor="demo-non-form">Range</label>
<mobiscroll.Range showSelector={false}>
<input id="demo-non-form" className="demo-non-form" placeholder="Please Select..." />
</mobiscroll.Range>
<label htmlFor="demo-external">External button</label>
<div className="external-container">
<mobiscroll.Range
ref={this.setExternal}
value={this.state.val}
showOnTap={false}
showOnFocus={false}
showSelector={false}
>
<input id="demo-external" className="demo-non-form" />
</mobiscroll.Range>
<button onClick={this.show} className="external-button">Show</button>
</div>
</div>
</div>
);
}
}
<div id="content">
.demo-non-form {
color: initial;
width: 100%;
padding: 10px;
margin: 6px 0 12px 0;
border: 1px solid #ccc;
border-radius: 0;
font-family: arial, verdana, sans-serif;
font-size: 14px;
box-sizing: border-box;
-webkit-appearance: none;
}
.demo-container {
padding: 0 1em;
}
.external-container {
display: flex;
}
.external-container button.external-button {
font-weight: 400;
padding: 10px;
margin: 6px 0 12px 16px;
}
Range - Time range
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
constructor(props) {
super(props);
const now = new Date();
const twoHours = [now, new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes() + 120)];
this.state = {
val: twoHours
};
}
show = () => {
this.external.instance.show();
}
setExternal = (comp) => {
this.external = comp;
}
render () {
return (
<div>
<mobiscroll.Form>
<div className="mbsc-align-center">
<div className="mbsc-note mbsc-note-primary">The range can be used inside a mobiscroll form or on any input.</div>
</div>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Two inputs inside Mobiscroll Form</mobiscroll.FormGroupTitle>
<mobiscroll.Range controls={['time']}>
<mobiscroll.RangeStart>
<mobiscroll.Input placeholder="Please Select ...">From</mobiscroll.Input>
</mobiscroll.RangeStart>
<mobiscroll.RangeEnd>
<mobiscroll.Input placeholder="Please Select ...">Until</mobiscroll.Input>
</mobiscroll.RangeEnd>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup className="mbsc-padding">
<p className="mbsc-thin">Use it on any input or non-mobiscroll form.</p>
</mobiscroll.FormGroup>
</mobiscroll.Form>
<div className="demo-container">
<label htmlFor="demo-non-form">Range</label>
<mobiscroll.Range controls={['time']}>
<input id="demo-non-form" className="demo-non-form" placeholder="Please Select..." />
</mobiscroll.Range>
<label htmlFor="demo-external">External button</label>
<div className="external-container">
<mobiscroll.Range
ref={this.setExternal}
controls={['time']}
value={this.state.val}
showOnTap={false}
showOnFocus={false}
>
<input id="demo-external" className="demo-non-form" />
</mobiscroll.Range>
<button onClick={this.show} className="external-button">Show</button>
</div>
</div>
</div>
);
}
}
<div id="content">
.demo-non-form {
color: initial;
width: 100%;
padding: 10px;
margin: 6px 0 12px 0;
border: 1px solid #ccc;
border-radius: 0;
font-family: arial, verdana, sans-serif;
font-size: 14px;
box-sizing: border-box;
-webkit-appearance: none;
}
.demo-container {
padding: 0 1em;
}
.external-container {
display: flex;
}
.external-container button.external-button {
font-weight: 400;
padding: 10px;
margin: 6px 0 12px 16px;
}
Range - Date and time range
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
constructor(props) {
super(props);
const now = new Date();
const week = [now, new Date(now.getFullYear(), now.getMonth(), now.getDate() + 6, 23, 59)];
this.state = {
val: week
};
}
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Calendar</mobiscroll.FormGroupTitle>
<mobiscroll.Range controls={['calendar', 'time']} value={this.state.val}>
<mobiscroll.RangeStart>
<mobiscroll.Input>From</mobiscroll.Input>
</mobiscroll.RangeStart>
<mobiscroll.RangeEnd>
<mobiscroll.Input>Until</mobiscroll.Input>
</mobiscroll.RangeEnd>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Scroller</mobiscroll.FormGroupTitle>
<mobiscroll.Range controls={['calendar', 'time']} value={this.state.val}>
<mobiscroll.RangeStart controls={['date', 'time']} dateWheels="|D M d|" dateWheels="|D M d|" cssClass="scroller-range" value={this.state.val}>
<mobiscroll.Input>Range start</mobiscroll.Input>
</mobiscroll.RangeStart>
<mobiscroll.RangeEnd>
<mobiscroll.Input>Range end</mobiscroll.Input>
</mobiscroll.RangeEnd>
</mobiscroll.Range>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
.scroller-range .mbsc-cal-tabs {
display: none;
}
/* Temporary fix */
.mbsc-cal-tabbed .mbsc-sc-whl-gr-c {
width: auto;
right: 0;
}
.mbsc-cal-tabbed .mbsc-sc-whl-gr {
width: auto;
}
Range - Min and Max
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
render() {
const now = new Date();
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1));
const tomorrow = new Date(new Date().setDate(new Date().getDate() + 1));
const nextMonths = new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
const day = 24 * 60 * 60 * 1000;
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Pick a range</mobiscroll.FormGroupTitle>
<mobiscroll.Range headerText="Select your next visit" max={yesterday}>
<mobiscroll.Input placeholder="Please Select...">Past range</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range min={tomorrow}>
<mobiscroll.Input placeholder="Please Select...">Future range</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range max={nextMonths} min={tomorrow}>
<mobiscroll.Input placeholder="Please Select...">Next 6 months</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range controls={['time']} min="08:00" max="18:59">
<mobiscroll.Input placeholder="Please Select...">Time range</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Specify range length</mobiscroll.FormGroupTitle>
<mobiscroll.Range minRange={5 * day}>
<mobiscroll.Input placeholder="Please Select...">Min 5 days</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range minRange={10 * day}>
<mobiscroll.Input placeholder="Please Select...">Max 10 days</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range minRange={5 * day} maxRange={10 * day}>
<mobiscroll.Input placeholder="Please Select...">5-10 days</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Date formats</mobiscroll.FormGroupTitle>
<mobiscroll.Range max="2018-08-31T00:00" min="08/01/2018">
<mobiscroll.Input placeholder="Please Select...">String</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range max={moment([2018, 8, 30])} min={moment([2018, 8, 1])}>
<mobiscroll.Input placeholder="Please Select...">Moment JS</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content">
Range - Invalid days
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
const invExact = [new Date(2018, 1, 3), new Date(2018, 1, 11), new Date(2018, 1, 12)];
const invWeek = ['w0', 'w6'];
const invRanges = [{ start: new Date(2018, 1, 3), end: new Date(2018, 1, 9)}, {start: new Date(2018, 1, 24), end: new Date(2018, 2, 2) }];
const invScroller = ['w0', 'w6'];
const invExTime = [
{ d: new Date(), start: '10:00', end: '10:00' },
{ d: new Date(), start: '10:30', end: '10:30' },
{ d: new Date(), start: '11:00', end: '11:00' },
{ d: new Date(), start: '12:30', end: '12:30' }
];
const invTimeRange = [{ start: '07:00', end: '09:00' }, { start: '13:00', end: '15:00' }];
const invDate =[{ start: new Date(2018, 11, 20), end: new Date(2018, 11, 31) }];
const valDate = [{ start: new Date(2018, 11, 24), end: new Date(2018, 11, 26) }];
const invTime = [{ start: '13:00', end: '20:00' }];
const valTime = [{ start: '17:00', end: '17:30' }, { start: '18:00', end: '18:30' }];
const invString = ['2018-07-08T00:00', '2018-07-10T00:00', '07/19/2018', '07/23/2018'];
const invMomemt = [ moment([2018, 8, 11]), moment([2018, 8, 15])];
const defVal = [new Date(2018, 1, 17), new Date(2018, 1, 23)];
const defDate = [new Date(2018, 11, 13), new Date(2018, 11, 19)];
const defTime = [new Date(new Date().setHours(12, 30, 0, 0)), new Date(new Date().setHours(12, 59, 0, 0))];
const defString = ['2018-07-15T00:00', '2018-07-15T00:00'];
const defMomemt = [moment([2018, 8, 24]), moment([2018, 8, 24])];
class App extends React.Component {
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Invalidating Dates</mobiscroll.FormGroupTitle>
<mobiscroll.Range invalid={invExact} defaultValue={defVal}>
<mobiscroll.Input placeholder="Please Select...">Exact dates</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range invalid={invWeek}>
<mobiscroll.Input placeholder="Please Select...">Weekdays</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range invalid={invRanges} defaultValue={defVal}>
<mobiscroll.Input placeholder="Please Select...">Ranges</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range invalid={invScroller} controls={['date']} defaultValue={defVal}>
<mobiscroll.Input placeholder="Please Select...">Scroller</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Invalidating Time</mobiscroll.FormGroupTitle>
<mobiscroll.Range controls={['time']} invalid={invExTime} steps={{minute: 30}}>
<mobiscroll.Input placeholder="Please Select...">Exact Time</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range controls={['time']} invalid={invTimeRange}>
<mobiscroll.Input placeholder="Please Select...">Range</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Overriding inside invalid ranges</mobiscroll.FormGroupTitle>
<mobiscroll.Range defaultValue={defDate} invalid={invDate} valid={valDate}>
<mobiscroll.Input placeholder="Please Select...">Date</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range controls={['time']} defaultValue={defTime} invalid={invTime} valid={valTime}>
<mobiscroll.Input placeholder="Please Select...">Time</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Date formats</mobiscroll.FormGroupTitle>
<mobiscroll.Range defaultValue={defString} invalid={invString}>
<mobiscroll.Input placeholder="Please Select...">String</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range defaultValue={defMomemt} invalid={invMomemt}>
<mobiscroll.Input placeholder="Please Select...">Moment JS</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content">
Range - Scroll direction
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Month change direction</mobiscroll.FormGroupTitle>
<mobiscroll.Range calendarScroll="vertical">
<mobiscroll.Input placeholder="Please Select...">Vertical</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range calendarScroll="horizontal">
<mobiscroll.Input placeholder="Please Select...">Horizontal</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Range - RTL Support
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
render() {
return (
<mobiscroll.Form rtl={true}>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>RTL enabled by default</mobiscroll.FormGroupTitle>
<mobiscroll.Range lang="ar">
<mobiscroll.Input placeholder="Please Select...">Arabic</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range lang="he">
<mobiscroll.Input placeholder="Please Select...">Hebrew</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range lang="fa">
<mobiscroll.Input placeholder="Please Select...">Farsi</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Manually set RTL</mobiscroll.FormGroupTitle>
<mobiscroll.Range rtl={true}>
<mobiscroll.Input placeholder="Please Select...">RTL</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Range - Presets
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
const curr = new Date();
const monday = new Date(curr.setDate(curr.getDate() - curr.getDay() + 1));
const sunday = new Date(curr.setDate(curr.getDate() - curr.getDay() + 7));
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
value: [monday, sunday]
};
}
setValue = (val, text) => {
this.setState({
value: val
});
mobiscroll.toast({
message: text + ' Selected'
});
}
render() {
const now = new Date();
const yesterday = new Date(curr.getFullYear(), curr.getMonth(), curr.getDate() - 1)
const firstday = new Date(curr.setDate(curr.getDate() - curr.getDay()));
const lastday = new Date(curr.setDate(curr.getDate() - curr.getDay() + 6));
const monthStart = new Date(now.getFullYear(), now.getMonth() - 1, 1);
const monthEnd = new Date(now.getFullYear(), now.getMonth(), 0);
return (
<div className="md-presets">
<mobiscroll.Form className="md-range-filter">
<h4 className="md-header">Filter Results by</h4>
<div className="mbsc-padding">
<mobiscroll.Button onClick={() => this.setValue([now, now], 'Today')} block={true} className="md-filter-btn">Today (3)</mobiscroll.Button>
<mobiscroll.Button onClick={() => this.setValue([yesterday, yesterday, 'Yesterday'])} block={true} className="md-filter-btn">Yesterday (8)</mobiscroll.Button>
<mobiscroll.Button onClick={() => this.setValue([firstday, lastday], 'This Week')} block={true} className="md-filter-btn">This Week (37)</mobiscroll.Button>
<mobiscroll.Button onClick={() => this.setValue([monthStart, monthEnd], 'Last Month')} block={true} className="md-filter-btn">Last Month (65)</mobiscroll.Button>
</div>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Or by a custom range</mobiscroll.FormGroupTitle>
<mobiscroll.Range
display="inline"
layout="liquid"
type="hidden"
showSelector={false}
value={this.state.value}
/>
</mobiscroll.FormGroup>
</mobiscroll.Form>
</div>
);
}
}
<div id="content"></div>
.md-range-filter .md-header {
text-align: center;
padding: 1em .75em 0 .75em;
margin: 0;
}
.md-range-filter .mbsc-form-group-title {
padding-top: 0;
text-align: center;
}
.md-range-filter .mbsc-ios .dw-dr {
height: 20px;
}
Range - Flight booking
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
constructor(props) {
super(props);
const now = new Date();
let departureDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 3);
let returnDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 7);
this.state = {
tripType: 'round',
origin: 'LTN',
destination: '',
timeRange: [departureDate, returnDate],
adults: 1,
children: 0,
infant: 0,
tripClass: 'economy'
};
}
tripTypeChange = (event) => {
// set default time range depending on trip type
let returnDate = null;
const departureDate = this.state.timeRange[0];
const value = event.target.value;
if (value === 'round') {
if (this.state.timeRange[1] !== null) {
returnDate = this.state.timeRange[1];
} else {
returnDate = new Date(departureDate.getFullYear(), departureDate.getMonth(), departureDate.getDate() + 7);
}
}
// push changes to state
this.setState({
tripType: value,
timeRange: [departureDate, returnDate]
});
}
// select time range
rangeSet = (event, inst) => {
if (this.state.tripType === 'round') {
this.setState({
timeRange: inst.getVal()
});
} else {
this.setState({
timeRange: [inst.getVal()[0], null]
});
}
}
rangeChange = (event, inst) => {
const oneWay = this.state.tripType === 'oneway';
if (oneWay && event.control === 'calendar' && event.active === 'start') {
inst._isVisible = false;
inst.setActiveDate('start');
inst._isVisible = true;
}
if (inst._markup) {
inst._isValid = true;
inst._markup.find('.mbsc-fr-btn-s .mbsc-fr-btn').removeClass('mbsc-fr-btn-d' + (oneWay ? ' mbsc-disabled' : ''));
}
}
rangeClose = () => {
if (this.state.tripType === 'oneway') {
return true;
}
}
// passenger numbers
adultsChange = (event) => {
this.setState({
adults: +event.target.value
});
}
childrenChange = (event) => {
this.setState({
children: +event.target.value
});
}
infantChange = (event) => {
this.setState({
infant: +event.target.value
});
}
// trip class selection
tripClassChange = (event) => {
this.setState({
tripClass: event.target.value
});
}
remoteData = {
url: 'https://trial.mobiscroll.com/airports/',
remoteFilter: true,
dataType: 'jsonp',
processResponse: (data) => {
let ret = [];
if (data) {
for (let i = 0; i < data.length; i++) {
const item = data[i];
ret.push({
value: item.code,
text: item.name,
html: '<div style="font-size:16px;line-height:18px;">' + item.name + '</div><div style="font-size:10px;line-height:12px;">' + item.location + ', ' + item.code + '</div>'
});
}
}
return ret;
}
}
render() {
return (
<mobiscroll.Form>
<mobiscroll.Segmented value="round" checked={this.state.tripType === 'round'} onChange={this.tripTypeChange} name="flightType">
Round trip
</mobiscroll.Segmented>
<mobiscroll.Segmented value="oneway" checked={this.state.tripType === 'oneway'} onChange={this.tripTypeChange} name="flightType">
One way
</mobiscroll.Segmented>
<mobiscroll.FormGroup>
<mobiscroll.Select value={this.state.origin} data={this.remoteData} multiline={2} height={50} filter={true}>
<mobiscroll.Input placeholder="Please select...">Origin</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select data={this.remoteData} multiline={2} height={50} filter={true} placeholder="Please select a city">
<mobiscroll.Input>Destination</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Range value={this.state.timeRange} onSet={this.rangeSet} onSetDate={this.rangeChange} onBeforeClose={this.rangeClose} min={new Date()} showSelector={false}>
<mobiscroll.RangeStart>
<mobiscroll.Input>Leaving</mobiscroll.Input>
</mobiscroll.RangeStart>
<mobiscroll.RangeEnd disabled={this.state.tripType === 'oneway'}>
<mobiscroll.Input>Returning</mobiscroll.Input>
</mobiscroll.RangeEnd>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.Stepper value={this.state.adults} onChange={this.adultsChange} min={1} max={15} data-val="left">
Adults
<span className="mbsc-desc">From 14 years</span>
</mobiscroll.Stepper>
<mobiscroll.Stepper value={this.state.children} onChange={this.childrenChange} min={0} max={15} data-val="left">
Children
<span className="mbsc-desc">2-14 years</span>
</mobiscroll.Stepper>
<mobiscroll.Stepper value={this.state.infant} onChange={this.infantChange} min={0} max={10} data-val="left">
Infant
<span className="mbsc-desc">0-2 years</span>
</mobiscroll.Stepper>
<mobiscroll.Segmented value="economy" checked={this.state.tripClass === 'economy'} onChange={this.tripClassChange} name="flightClass">
Economy
</mobiscroll.Segmented>
<mobiscroll.Segmented value="comfort" checked={this.state.tripClass === 'comfort'} onChange={this.tripClassChange} name="flightClass">
Comfort
</mobiscroll.Segmented>
<mobiscroll.Segmented value="business" checked={this.state.tripClass === 'business'} onChange={this.tripClassChange} name="flightClass">
Business
</mobiscroll.Segmented>
</mobiscroll.FormGroup>
<div className="mbsc-btn-group-block">
<mobiscroll.Button>Find Flights</mobiscroll.Button>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
/* range inputs */
.md-flight-booking .md-time-range {
overflow: hidden;
width: 99%;
}
.mbsc-ios .md-time-range {
background: #fff;
}
.md-time-range .mbsc-input {
float: left;
width: 50%;
box-sizing: border-box;
}
.mbsc-ios .md-time-range .mbsc-input {
display: block;
}
.mbsc-ios .md-time-range .mbsc-input .mbsc-label {
font-size: 14px;
padding-left: 1.14285em;
padding-top: 0.75em;
line-height: 22px;
}
Range - New event
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
activity: 'busy',
allDay: true,
selected: 1,
travelTime: [{
value: 1,
text: 'None'
}, {
value: 5,
text: '5 minutes'
}, {
value: 30,
text: '30 minutes'
}, {
value: 60,
text: '1 hour'
}, {
value: 90,
text: '1 hour and 30 minutes'
}, {
value: 120,
text: '2 hours'
}]
};
}
setActivity = (event) => {
this.setState({
activity: event.target.value
});
}
setAllDay = (ev) => {
this.setState({
allDay: ev.target.checked
});
}
render() {
return (
<mobiscroll.Form className="md-range-event">
<div className="md-header">
<mobiscroll.Button className="mbsc-btn-flat md-cancel-btn">Cancel</mobiscroll.Button>
<div className="mbsc-header-txt">New event</div>
<mobiscroll.Button className="mbsc-btn-flat md-add-btn">Add</mobiscroll.Button>
</div>
<mobiscroll.Input placeholder="Name of the event">Title</mobiscroll.Input>
<mobiscroll.Input placeholder="Where will it be?">Location</mobiscroll.Input>
<mobiscroll.Switch checked={this.state.allDay} onChange={this.setAllDay} color="primary">All day</mobiscroll.Switch>
<mobiscroll.Range min={new Date()} controls={['date']} dateFormat="M dd D yy">
<mobiscroll.RangeStart className="md-time">
<mobiscroll.Input placeholder="Event start">Starts</mobiscroll.Input>
</mobiscroll.RangeStart>
<mobiscroll.RangeEnd className="md-time md-time-end">
<mobiscroll.Input placeholder="Event end">Ends</mobiscroll.Input>
</mobiscroll.RangeEnd>
</mobiscroll.Range>
<mobiscroll.Select data={this.state.travelTime} value={this.state.selected}>
<mobiscroll.Input>Travel Time</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Segmented name="type" value="busy" checked={this.state.activity === 'busy'} onChange={this.setActivity}>
Show as busy
</mobiscroll.Segmented>
<mobiscroll.Segmented name="type" value="free" checked={this.state.activity === 'free'} onChange={this.setActivity}>
Show as free
</mobiscroll.Segmented>
<mobiscroll.Textarea placeholder="Enter notes, URL, comments">Notes</mobiscroll.Textarea>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
.md-range-event .md-header {
position: relative;
background: #4ECCC4;
padding: 1em;
text-align: center;
margin-bottom: 1em;
}
.mbsc-material.md-range-event .md-header,
.md-range-event .mbsc-material .md-header {
background: #009688;
}
.mbsc-android-holo.md-range-event .md-header,
.md-range-event .mbsc-android-holo .md-header {
background: #31c6e7;
}
.mbsc-ios-classic.md-range-event .md-header,
.mbsc-ios.md-range-event .md-header,
.md-range-event .mbsc-ios .md-header {
background: #1272dc;
margin: 0;
z-index: 1;
}
.mbsc-ios-dark.md-range-event .md-header,
.md-range-event .mbsc-ios-dark .md-header {
background: #ff8b0f;
margin: 0;
color: #a1a1a1;
}
.mbsc-wp.md-range-event .md-header,
.md-range-event .mbsc-wp .md-header {
background: #1a9fe0;
}
.md-range-event .md-header .mbsc-header-txt {
display: inline-block;
color: #fff;
font-size: 18px;
}
.md-range-event .md-header .mbsc-btn-flat {
margin: 0;
padding: 0 .5em 0 .5em;
height: 30px;
color: #fff;
text-transform: capitalize;
}
.md-range-event .md-header .md-cancel-btn,
.md-range-event .md-header .md-add-btn {
position: absolute;
top: 50%;
margin-top: -15px;
}
.md-range-event .md-header .mbsc-btn-flat.mbsc-active {
background: rgba(255, 255, 255, 0.2);
}
.md-range-event .md-header .md-add-btn {
right: .75em;
}
.md-range-event .md-header .md-cancel-btn {
left: .75em;
}
Range - Date types
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
date: null,
iso: null,
locale: null,
moment: null,
retDate: '',
retISO: '',
retLocale: '',
retMoment: ''
};
}
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Working with Js Date Objects</mobiscroll.FormGroupTitle>
<div className="mbsc-btn-group-block">
<mobiscroll.Button onClick={this.onClickDate}>Set: Sun Dec 17 1995 03:24:00 GMT - Thu Dec 28 1995 11:45:00 GMT+0200</mobiscroll.Button>
</div>
<div>
<mobiscroll.Range onSet={this.onSetDate} value={this.state.date}>
<mobiscroll.Input>Date object</mobiscroll.Input>
</mobiscroll.Range>
</div>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup className="mbsc-padding">
Return value: {this.state.retDate}
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Working with Date strings</mobiscroll.FormGroupTitle>
<div className="mbsc-btn-group-block">
<mobiscroll.Button onClick={this.onClickISO}>Set: 2008-09-15T15:53:00 - 2008-09-23T16:15:00</mobiscroll.Button>
</div>
<div>
<mobiscroll.Range returnFormat="iso8601" onSet={this.onSetISO} value={this.state.iso}>
<mobiscroll.Input>ISO string</mobiscroll.Input>
</mobiscroll.Range>
</div>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup className="mbsc-padding">
Return value: {this.state.retISO}
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Working with Localized Strings</mobiscroll.FormGroupTitle>
<div className="mbsc-btn-group-block">
<mobiscroll.Button onClick={this.onClickLocale}>Set: 04/25/2010 8:15 AM - 05/04/2010 10:30 AM</mobiscroll.Button>
</div>
<div>
<mobiscroll.Range returnFormat="locale" onSet={this.onSetLocale} value={this.state.locale}>
<mobiscroll.Input>Local format</mobiscroll.Input>
</mobiscroll.Range>
</div>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup className="mbsc-padding">
Return value: {this.state.retLocale}
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Working with Moment JS Objects</mobiscroll.FormGroupTitle>
<div className="mbsc-btn-group-block">
<mobiscroll.Button onClick={this.onClickMoment}>Set: 2018-04-18T15:00:00+03:00 - 2018-04-26T10:00:00+03:00</mobiscroll.Button>
</div>
<div>
<mobiscroll.Range returnFormat="moment" onSet={this.onSetMoment} value={this.state.moment}>
<mobiscroll.Input>Moment JS</mobiscroll.Input>
</mobiscroll.Range>
</div>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup className="mbsc-padding">
Return value: {this.state.retMoment}
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
};
setDate(date) {
this.setState({
date: date,
retDate: date.toString()
});
}
onClickDate = () => {
this.setDate([new Date(1995, 11, 17, 15, 24), new Date(1995, 11, 28, 11, 45)]);
};
onSetDate = (event, inst) => {
this.setDate(inst.getVal());
};
setISO(iso) {
this.setState({
iso: iso,
retISO: iso
});
}
onClickISO = () => {
this.setISO(['2008-09-15T15:53:00', '2008-09-23T16:15:00']);
};
onSetISO = (event, inst) => {
this.setISO(inst.getVal());
};
setLocale(locale) {
this.setState({
locale: locale,
retLocale: locale
});
}
onClickLocale = () => {
this.setLocale(['04/25/2010 8:15 AM', '05/04/2010 10:30 AM']);
};
onSetLocale = (event, inst) => {
this.setLocale(inst.getVal());
};
setMoment(moment) {
this.setState({
moment: moment,
retMoment: moment.toString()
});
}
onClickMoment = () => {
// make sure that moment js is loaded
this.setMoment([moment([2018, 3, 18, 15]), moment([2018, 3, 26, 10])]);
};
onSetMoment = (event, inst) => {
this.setMoment(inst.getVal());
};
}
<div id="content"></div>
Range - Event handlers
EVENTS FIRED:
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
class App extends React.Component {
//<extra>
show = () =>{
this.range.instance.show();
}
clear = () =>{
this.range.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
}
onChange = (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
}
onDayChange = (event, inst) => {
// Your custom event handler goes here
}
onPageChange = (event, inst) => {
// Your custom event handler goes here
}
onPageLoaded = (event, inst) => {
// Your custom event handler goes here
}
onPageLoading = (event, inst) => {
// Your custom event handler goes here
}
onSetDate = (event, inst) => {
// Your custom event handler goes here
}
onTabChange = (event, inst) => {
// Your custom event handler goes here
}
setRef = (comp) => {
this.range = comp;
}
render() {
return (
<div>
<mobiscroll.Range
ref={this.setRef}
theme=""
themeVariant=""
lang=""
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}
onChange={this.onChange}
onCancel={this.onCancel}
onBeforeClose={this.onBeforeClose}
onClear={this.onClear}
onTabChange={this.onTabChange}
onSetDate={this.onSetDate}
onPageLoading={this.onPageLoading}
onPageLoaded={this.onPageLoaded}
onPageChange={this.onPageChange}
onDayChange={this.onDayChange}
placeholder="Please Select..."
/>
<button onClick={this.clear}>Clear</button>
<button onClick={this.show}>Show</button>
</div>
);
}
}
<div id="content"></div>
Range - Marked, colored & labels
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
constructor(props) {
super(props);
const now = new Date();
this.state = {
marked : [
{ d: '5/1', color: '#ffc400' },
{ d: '12/24', color: '#ffee00' },
{ d: '12/25', color: 'red' },
{ d: new Date(now.getFullYear(), now.getMonth() + 1, 4) },
{ d: new Date(now.getFullYear(), now.getMonth() - 2, 13) },
{ d: new Date(now.getFullYear(), now.getMonth(), 2), color: '#46c4f3' },
{ d: new Date(now.getFullYear(), now.getMonth(), 6), color: '#7e56bd' },
{ d: new Date(now.getFullYear(), now.getMonth(), 11), color: '#7e56bd' },
{ d: new Date(now.getFullYear(), now.getMonth(), 19), color: '#89d7c9' },
{ d: new Date(now.getFullYear(), now.getMonth(), 28), color: '#ea4986' },
{ d: new Date(now.getFullYear(), now.getMonth(), 13), color: '#7e56bd' },
{ d: new Date(now.getFullYear(), now.getMonth(), 13), color: '#f13f77' },
{ d: new Date(now.getFullYear(), now.getMonth(), 13), color: '#89d7c9' },
{ d: new Date(now.getFullYear(), now.getMonth(), 13), color: '#8dec7d' },
{ d: new Date(now.getFullYear(), now.getMonth(), 21), color: '#ffc400' },
{ d: new Date(now.getFullYear(), now.getMonth(), 21), color: '#8dec7d' },
{ start: new Date(now.getFullYear(), now.getMonth() + 1, 15), end: new Date(now.getFullYear(), now.getMonth() + 1, 18), color: '#f4511e' }
],
colors: [
{ d: '12/8', background: '#9ccc65' },
{ d: '5/1', background: 'red' },
{ d: '12/24', background: "#fff568" },
{ d: '12/25', background: "#e88080" },
{ d: new Date(now.getFullYear(), now.getMonth() + 1, 4), background: '#cfd8dc' },
{ d: new Date(now.getFullYear(), now.getMonth() + 2, 24), background: '#9575cd' },
{ d: new Date(now.getFullYear(), now.getMonth() - 2, 13), background: '#d4e157' },
{ d: new Date(now.getFullYear(), now.getMonth() - 1, 6), background: "#f4511e" },
{ d: new Date(now.getFullYear(), now.getMonth() + 1, 6), background: '#46c4f3' },
{ d: new Date(now.getFullYear(), now.getMonth() + 1, 22), background: '#7e56bd' },
{ d: new Date(now.getFullYear(), now.getMonth() - 1, 11), background: '#46c4f3' },
{ d: new Date(now.getFullYear(), now.getMonth() - 1, 29), background: '#7e56bd' },
{ d: new Date(now.getFullYear(), now.getMonth(), 2), background: '#46c4f3' },
{ d: new Date(now.getFullYear(), now.getMonth(), 3), background: '#7e56bd' },
{ d: new Date(now.getFullYear(), now.getMonth(), 11), background: '#f13f77' },
{ d: new Date(now.getFullYear(), now.getMonth(), 19), background: '#8dec7d' },
{ d: new Date(now.getFullYear(), now.getMonth(), 28), background: '#ea4986' },
{ start: new Date(now.getFullYear(), now.getMonth() + 1, 15), end: new Date(now.getFullYear(), now.getMonth() + 1, 18), text: 'Conference', background: '#f4511e' }
],
labels: [
{ d: '12/25', text: 'Christmas', color: "#f48fb1" },
{ d: '1/1', text: 'New year' },
{ d: '12/1', text: 'Meeting', color: '#ffc400' },
{ d: new Date(now.getFullYear(), now.getMonth() + 1, 4), text: 'Spa day', color: '#cfd8dc' },
{ d: new Date(now.getFullYear(), now.getMonth() + 2, 24), text: 'BD Party', color: '#9ccc65' },
{ d: new Date(now.getFullYear(), now.getMonth() - 2, 13), text: 'Exams', color: '#d4e157' },
{ d: new Date(now.getFullYear(), now.getMonth() - 1, 6), text: 'Trip', color: "#f4511e" },
{ d: new Date(now.getFullYear(), now.getMonth() + 1, 6), color: '#46c4f3', text: 'Pizza Night' },
{ d: new Date(now.getFullYear(), now.getMonth() + 1, 22), color: '#7e56bd', text: 'Beerpong' },
{ d: new Date(now.getFullYear(), now.getMonth() - 1, 11), color: '#46c4f3', text: 'Anniversary' },
{ d: new Date(now.getFullYear(), now.getMonth() - 1, 29), color: '#7e56bd', text: 'Pete BD' },
{ d: new Date(now.getFullYear(), now.getMonth(), 2), color: '#46c4f3', text: 'Ana BD' },
{ d: new Date(now.getFullYear(), now.getMonth(), 3), color: '#7e56bd', text: 'Concert' },
{ d: new Date(now.getFullYear(), now.getMonth(), 11), color: '#f13f77', text: 'Trip' },
{ d: new Date(now.getFullYear(), now.getMonth(), 19), color: '#8dec7d', text: 'Math exam' },
{ d: new Date(now.getFullYear(), now.getMonth(), 28), color: '#ea4986', text: 'Party' },
{ start: new Date(now.getFullYear(), now.getMonth() + 1, 15), end: new Date(now.getFullYear(), now.getMonth() + 1, 18), text: 'Conference', color: '#f4511e' }
]
};
}
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Marked days</mobiscroll.FormGroupTitle>
<mobiscroll.Range
marked={this.state.marked}
display="inline"
type="hidden"
showSelector={false}
/>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Colored days</mobiscroll.FormGroupTitle>
<mobiscroll.Range
colors={this.state.colors}
display="inline"
type="hidden"
showSelector={false}
/>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Labels</mobiscroll.FormGroupTitle>
<mobiscroll.Range
labels={this.state.labels}
display="inline"
type="hidden"
showSelector={false}
/>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Range - Display modes
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Try different display modes</mobiscroll.FormGroupTitle>
<mobiscroll.Range display="bottom">
<mobiscroll.Input placeholder="Please Select...">Bottom</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range display="top">
<mobiscroll.Input placeholder="Please Select...">Top</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range display="center">
<mobiscroll.Input placeholder="Please Select...">Center</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range display="bubble">
<mobiscroll.Input placeholder="Please Select...">Bubble</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup className="mbsc-padding">
<p className="mbsc-thin">With inline display you can embed the Range component in almost any markup or form.</p>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Embedded range picker</mobiscroll.FormGroupTitle>
<mobiscroll.Range type="hidden" display="inline" layout="liquid"/>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Range - Weeks
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
class App extends React.Component {
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>One week view</mobiscroll.FormGroupTitle>
<mobiscroll.Range
weeks={1}
display="inline"
type="hidden"
showSelector={false}
/>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Two week view</mobiscroll.FormGroupTitle>
<mobiscroll.Range
weeks={2}
display="inline"
type="hidden"
showSelector={false}
/>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Three week view</mobiscroll.FormGroupTitle>
<mobiscroll.Range
weeks={3}
display="inline"
type="hidden"
showSelector={false}
/>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Range - Multi month view
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Popover range</mobiscroll.FormGroupTitle>
<mobiscroll.Range display="bubble" months={2} yearChange={false}>
<mobiscroll.Input placeholder="Please Select...">Two months</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range display="bubble" months={3} yearChange={false}>
<mobiscroll.Input placeholder="Please Select...">Three months</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range display="bubble" months={4} yearChange={false}>
<mobiscroll.Input placeholder="Please Select...">Four months</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range display="bubble" months="auto" yearChange={false}>
<mobiscroll.Input placeholder="Please Select...">Auto</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Center positioned range</mobiscroll.FormGroupTitle>
<mobiscroll.Range display="center" months={2} yearChange={false}>
<mobiscroll.Input placeholder="Please Select...">Two months</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range display="center" months={3} yearChange={false}>
<mobiscroll.Input placeholder="Please Select...">Three months</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range display="center" months={4} yearChange={false}>
<mobiscroll.Input placeholder="Please Select...">Four months</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range display="center" months="auto" yearChange={false}>
<mobiscroll.Input placeholder="Please Select...">Auto</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Range - Calendar systems
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
render() {
return (
<mobiscroll.Form>
<div className="mbsc-grid">
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Gregorian calendar</mobiscroll.FormGroupTitle>
<mobiscroll.Range
display="inline"
calendarSystem="gregorian"
type="hidden"
/>
</mobiscroll.FormGroup>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Jalali calendar</mobiscroll.FormGroupTitle>
<mobiscroll.Range
display="inline"
calendarSystem="jalali"
lang="fa"
type="hidden"
/>
</mobiscroll.FormGroup>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Hijri calendar</mobiscroll.FormGroupTitle>
<mobiscroll.Range
display="inline"
calendarSystem="hijri"
lang="ar"
type="hidden"
/>
</mobiscroll.FormGroup>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Range - 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() {
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.Range touchUi={false} display="top">
<mobiscroll.Input placeholder="Please Select...">Top</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range touchUi={false} display="bottom">
<mobiscroll.Input placeholder="Please Select...">Bottom</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Anchored</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range touchUi={false} display="center">
<mobiscroll.Input placeholder="Please Select...">Center</mobiscroll.Input>
</mobiscroll.Range>
</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>Scroller components</mobiscroll.FormGroupTitle>
<mobiscroll.Range touchUi={false} controls={['date', 'time']} dateWheels="|D M d|" cssClass="scroller-range">
<mobiscroll.Input placeholder="Please Select...">Date & Time</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range touchUi={false} controls={['date']}>
<mobiscroll.Input placeholder="Please Select...">Date</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range touchUi={false} controls={['time']}>
<mobiscroll.Input placeholder="Please Select...">Time</mobiscroll.Input>
</mobiscroll.Range>
</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.Range touchUi={false} display="center" buttons={['set']}>
<mobiscroll.Input placeholder="Please Select...">Set button</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range touchUi={false} display="center" buttons={['set', 'cancel']}>
<mobiscroll.Input placeholder="Please Select...">Set/Cancel</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
.scroller-range .mbsc-cal-tabs {
display: none;
}
Range - Theming capabilities
The look and feel of the range 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 () {
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.Range theme="ios" themeVariant="light" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Light</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range theme="ios" themeVariant="dark" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Dark</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range theme="ios-gray" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Custom</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Material Theme</mobiscroll.FormGroupTitle>
<mobiscroll.Range theme="material" themeVariant="light" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Light</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range theme="material" themeVariant="dark" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Dark</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range theme="material-indigo" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Custom</mobiscroll.Input>
</mobiscroll.Range>
</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.Range theme="windows" themeVariant="light" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Light</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range theme="windows" themeVariant="dark" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Dark</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range theme="windows-yellow" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Custom</mobiscroll.Input>
</mobiscroll.Range>
</mobiscroll.FormGroup>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Mobiscroll Theme</mobiscroll.FormGroupTitle>
<mobiscroll.Range theme="mobiscroll" themeVariant="light" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Light</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range theme="mobiscroll" themeVariant="dark" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Dark</mobiscroll.Input>
</mobiscroll.Range>
<mobiscroll.Range theme="mobiscroll-lime" display="bubble" touchUi={false}>
<mobiscroll.Input placeholder="Please Select...">Custom</mobiscroll.Input>
</mobiscroll.Range>
</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! 👍