React Select
Select for React
Select for React
Select for React
Learn more
Advanced select component for single and multiple value selection. Provides a great alternative to the native dropdown with enhanced UX.
Can be used on mobiscroll form elements or on any input, select and field.
Shipping with useful features:
- Single or multiple value selection
- Group header and list segmentation
- On demand rendering for long lists
- Built in support for invalids and un-selectable values
- Filtering and autocomplete with type ahead
- Circular wheels
- Multiple theme support
- Modal, popup and inline display support
- RTL Support
- Full localization
Interested in scroller controls? Other demos that could be useful:
Select demos available for other frameworks.
Viewing demos & code for
Select - Mobile & Desktop usage
Use the select for both mobile and desktop or set it up responsively. The main difference between the two rendering modes - controlled by the touchUi
setting - is how the component is laid out.
When set to false
the component shows up suitable for larger screens and pointer interaction while setting it to true
renders it suitable for touch screens.
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
items: [{
value: 1,
text: 'Atlanta'
}, {
value: 2,
text: 'Berlin'
}, {
value: 3,
text: 'Boston'
}, {
value: 4,
text: 'Chicago'
}, {
value: 5,
text: 'London'
}, {
value: 6,
text: 'Los Angeles'
}, {
value: 7,
text: 'New York'
}, {
value: 8,
text: 'Paris'
}, {
value: 9,
text: 'San Francisco'
}],
value: 1
};
}
render () {
return (
<mobiscroll.Form>
<div className="mbsc-grid mbsc-form-grid">
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select display="bubble" data={this.state.items} value={this.state.value}>
<mobiscroll.Input inputStyle="box">Mobile</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select display="bubble" touchUi={false} data={this.state.items} value={this.state.value}>
<mobiscroll.Input inputStyle="box">Desktop</mobiscroll.Input>
</mobiscroll.Select>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - App & Website usage
Use it on any custom input or with Mobiscroll form fields. The select is shown on input focus, but it can also be triggered on a button click or it can be embedded directly into the page.
Let’s say you already have a form and you want a custom dropdown. You can use it on existing fields or new fields.
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
data: [{
value: 1,
text: 'Atlanta'
}, {
value: 2,
text: 'Berlin'
}, {
value: 3,
text: 'Boston'
}, {
value: 4,
text: 'Chicago'
}, {
value: 5,
text: 'London'
}, {
value: 6,
text: 'Los Angeles'
}, {
value: 7,
text: 'New York'
}, {
value: 8,
text: 'Paris'
}, {
value: 9,
text: 'San Francisco'
}],
value: 1,
header: 1,
nonform: 1,
external: 1
};
}
show = () => {
this.external.instance.show();
}
setExternal = (comp) => {
this.external = comp;
}
render () {
return (
<div>
<mobiscroll.Form inputStyle="box">
<div className="mbsc-grid mbsc-form-grid">
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Using the Select with Mobiscroll form fields</mobiscroll.FormGroupTitle>
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select display="bubble" value={this.state.value} data={this.state.data}>
<mobiscroll.Input inputStyle="box">Select</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select display="bubble" value={this.state.header} data={this.state.data} headerText="Pick location">
<mobiscroll.Input inputStyle="box">Header text</mobiscroll.Input>
</mobiscroll.Select>
</div>
</div>
</mobiscroll.FormGroup>
</div>
</mobiscroll.Form>
<div className="mbsc-grid">
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<label htmlFor="demo-non-form">Select</label>
<mobiscroll.Select
display="bubble"
value={this.state.nonform}
data={this.state.data}
inputClass="demo-non-form"
/>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<div className="mbsc-row mbsc-align-items-end">
<div className="mbsc-col-9">
<label htmlFor="demo-external">Show on button click only</label>
<mobiscroll.Select
ref={this.setExternal}
display="bubble"
value={this.state.external}
data={this.state.data}
inputClass="demo-non-form"
showOnTap={false}
showOnFocus={false}
/>
</div>
<div className="mbsc-col-3 external-container">
<button onClick={this.show} className="external-button">Show</button>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
}
<div id="content"></div>
.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 13px 0;
width: 100%;
}
Select - Mobile display modes
Different display modes can be used for mobile and desktop. On mobile, the select can be rendered at the top or bottom of the screen, in the center of the screen, anchored to an input or any object for that matter and it can also be embedded in any inline content.
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
data: [{
value: 1,
text: 'Atlanta'
}, {
value: 2,
text: 'Berlin'
}, {
value: 3,
text: 'Boston'
}, {
value: 4,
text: 'Chicago'
}, {
value: 5,
text: 'London'
}, {
value: 6,
text: 'Los Angeles'
}, {
value: 7,
text: 'New York'
}, {
value: 8,
text: 'Paris'
}, {
value: 9,
text: 'San Francisco'
}]
};
}
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Try different display modes</mobiscroll.FormGroupTitle>
<mobiscroll.Select display="bottom" value={1} data={this.state.data}>
<mobiscroll.Input>Bottom</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select display="top" value={1} data={this.state.data}>
<mobiscroll.Input>Top</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select display="center" value={1} data={this.state.data}>
<mobiscroll.Input>Center</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select display="bubble" value={1} data={this.state.data}>
<mobiscroll.Input>Bubble</mobiscroll.Input>
</mobiscroll.Select>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup className="mbsc-padding">
<p className="mbsc-thin">With inline display you can embed the Select component in almost any markup or form.</p>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Embedded select scroller</mobiscroll.FormGroupTitle>
<mobiscroll.Select showInput={false} display="inline" value={1} data={this.state.data}>
</mobiscroll.Select>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - Desktop display modes
Use the available display modes on mobile and desktop. On larger screens you have slightly different rendering options suitable for the large form-factor and pointer interaction. Use the top, bottom and center modes for getting it in front of the users or stay in context and anchor it to the input.
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
data: [{
value: 1,
text: 'Atlanta'
}, {
value: 2,
text: 'Berlin'
}, {
value: 3,
text: 'Boston'
}, {
value: 4,
text: 'Chicago'
}, {
value: 5,
text: 'London'
}, {
value: 6,
text: 'Los Angeles'
}, {
value: 7,
text: 'New York'
}, {
value: 8,
text: 'Paris'
}, {
value: 9,
text: 'San Francisco'
}],
value: 1
};
}
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.Note color="primary" className="mbsc-align-center">The Select component can be used on mobile and desktop. See desktop functionality below.</mobiscroll.Note>
<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>Basic usage</mobiscroll.FormGroupTitle>
<label>
Single select
<mobiscroll.Select
touchUi={false}
value={1}
>
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</mobiscroll.Select>
</label>
<label>
Multi-select
<mobiscroll.Select
touchUi={false}
value={[3,4]}
select="multiple"
>
<option value="1">Books</option>
<option value="2">Movies, Music & Games</option>
<option value="3">Electronics & Computers</option>
<option value="4">Home, Garden & Tools</option>
<option value="5">Health & Beauty</option>
<option value="6">Toys, Kids & Baby</option>
<option value="7">Clothing & Jewelry</option>
<option value="8">Sports & Outdoors</option>
</mobiscroll.Select>
</label>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Pop-up positioning</mobiscroll.FormGroupTitle>
<label>
Top
<mobiscroll.Select
touchUi={false}
value={1}
display="top"
>
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</mobiscroll.Select>
</label>
<label>
Bottom
<mobiscroll.Select
touchUi={false}
value={1}
display="bottom"
>
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</mobiscroll.Select>
</label>
<label>
Anchored
<mobiscroll.Select
touchUi={false}
value={1}
>
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</mobiscroll.Select>
</label>
<label>
Center
<mobiscroll.Select
touchUi={false}
value={1}
display="center"
>
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</mobiscroll.Select>
</label>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Group select & segmentation</mobiscroll.FormGroupTitle>
<label>
Group select
<mobiscroll.Select
touchUi={false}
value={1}
>
<optgroup label="USA">
<option value="1">Atlanta</option>
<option value="2">Boston</option>
<option value="3">Chicago</option>
<option value="4">Los Angeles</option>
<option value="5">New York</option>
<option value="6">San Francisco</option>
</optgroup>
<optgroup label="UK">
<option value="7">Bath</option>
<option value="8">Bristol</option>
<option value="9">Cambridge</option>
<option value="10">London</option>
<option value="11">Leeds</option>
<option value="12">Manchester</option>
<option value="13">Newcastle</option>
<option value="14">Oxford</option>
</optgroup>
<optgroup label="China">
<option value="15">Beijing</option>
<option value="16">Chongqing</option>
<option value="17">Shanghai</option>
<option value="18">Shenzhen</option>
<option value="19">Tianjin</option>
</optgroup>
</mobiscroll.Select>
</label>
<label>
Group wheel
<mobiscroll.Select
touchUi={false}
value={1}
group={true}
>
<optgroup label="USA">
<option value="1">Atlanta</option>
<option value="2">Boston</option>
<option value="3">Chicago</option>
<option value="4">Los Angeles</option>
<option value="5">New York</option>
<option value="6">San Francisco</option>
</optgroup>
<optgroup label="UK">
<option value="7">Bath</option>
<option value="8">Bristol</option>
<option value="9">Cambridge</option>
<option value="10">London</option>
<option value="11">Leeds</option>
<option value="12">Manchester</option>
<option value="13">Newcastle</option>
<option value="14">Oxford</option>
</optgroup>
<optgroup label="China">
<option value="15">Beijing</option>
<option value="16">Chongqing</option>
<option value="17">Shanghai</option>
<option value="18">Shenzhen</option>
<option value="19">Tianjin</option>
</optgroup>
</mobiscroll.Select>
</label>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Filtering & autocomplete</mobiscroll.FormGroupTitle>
<label>
Remote data
<mobiscroll.Select
display="center"
touchUi={false}
multiline={2}
height={50}
filter={true}
data={this.remoteData}
placeholder="Please select..."
></mobiscroll.Select>
</label>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>With buttons</mobiscroll.FormGroupTitle>
<label>
Set button
<mobiscroll.Select
touchUi={false}
display="center"
buttons={['set']}
placeholder="Please select..."
>
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</mobiscroll.Select>
</label>
<label>
Set/Cancel
<mobiscroll.Select
touchUi={false}
display="center"
buttons={['set', 'cancel']}
placeholder="Please select..."
>
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</mobiscroll.Select>
</label>
</mobiscroll.FormGroup>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - Responsive
Use the select dropdown responsively. You can set positioning and rendering based on the screen size. Having a bottom positioned select on mobile, a popover anchored to the input on tablet and desktop display on large sceens is simple.
All this can be configured under the responsive
setting where you pass the options for each breakpoint.
responsive: { xsmall: { ... }, small: { ... }, medium: { ... }, large: { ... }, xlarge: { ... } }
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
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;
}
}
getResposiveSetting = () => {
return {
small: {
display: 'bubble'
},
medium: {
touchUi: false
}
}
}
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>Basic usage</mobiscroll.FormGroupTitle>
<label>
Single select
<mobiscroll.Select
responsive={this.getResposiveSetting()}
value={1}
>
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</mobiscroll.Select>
</label>
<label>
Multi-select
<mobiscroll.Select
responsive={this.getResposiveSetting()}
value={[3,4]}
select="multiple"
>
<option value="1">Books</option>
<option value="2">Movies, Music & Games</option>
<option value="3">Electronics & Computers</option>
<option value="4">Home, Garden & Tools</option>
<option value="5">Health & Beauty</option>
<option value="6">Toys, Kids & Baby</option>
<option value="7">Clothing & Jewelry</option>
<option value="8">Sports & Outdoors</option>
</mobiscroll.Select>
</label>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Group select & segmentation</mobiscroll.FormGroupTitle>
<label>
Group select
<mobiscroll.Select
responsive={this.getResposiveSetting()}
value={1}
>
<optgroup label="USA">
<option value="1">Atlanta</option>
<option value="2">Boston</option>
<option value="3">Chicago</option>
<option value="4">Los Angeles</option>
<option value="5">New York</option>
<option value="6">San Francisco</option>
</optgroup>
<optgroup label="UK">
<option value="7">Bath</option>
<option value="8">Bristol</option>
<option value="9">Cambridge</option>
<option value="10">London</option>
<option value="11">Leeds</option>
<option value="12">Manchester</option>
<option value="13">Newcastle</option>
<option value="14">Oxford</option>
</optgroup>
<optgroup label="China">
<option value="15">Beijing</option>
<option value="16">Chongqing</option>
<option value="17">Shanghai</option>
<option value="18">Shenzhen</option>
<option value="19">Tianjin</option>
</optgroup>
</mobiscroll.Select>
</label>
<label>
Group wheel
<mobiscroll.Select
responsive={this.getResposiveSetting()}
value={1}
group={true}
>
<optgroup label="USA">
<option value="1">Atlanta</option>
<option value="2">Boston</option>
<option value="3">Chicago</option>
<option value="4">Los Angeles</option>
<option value="5">New York</option>
<option value="6">San Francisco</option>
</optgroup>
<optgroup label="UK">
<option value="7">Bath</option>
<option value="8">Bristol</option>
<option value="9">Cambridge</option>
<option value="10">London</option>
<option value="11">Leeds</option>
<option value="12">Manchester</option>
<option value="13">Newcastle</option>
<option value="14">Oxford</option>
</optgroup>
<optgroup label="China">
<option value="15">Beijing</option>
<option value="16">Chongqing</option>
<option value="17">Shanghai</option>
<option value="18">Shenzhen</option>
<option value="19">Tianjin</option>
</optgroup>
</mobiscroll.Select>
</label>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Filtering & autocomplete</mobiscroll.FormGroupTitle>
<label>
Remote data
<mobiscroll.Select
display="center"
responsive={this.getResposiveSetting()}
multiline={2}
height={50}
filter={true}
data={this.remoteData}
placeholder="Please select..."
></mobiscroll.Select>
</label>
</mobiscroll.FormGroup>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - Multiple select
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 inputStyle="box" labelStyle="stacked">
<div className="mbsc-grid mbsc-form-grid">
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<label>
Multi-select
<mobiscroll.Select
display="bubble"
select="multiple"
name="Category"
value={[3,4]}
>
<option value="1">Books</option>
<option value="2">Movies, Music & Games</option>
<option value="3">Electronics & Computers</option>
<option value="4">Home, Garden & Tools</option>
<option value="5">Health & Beauty</option>
<option value="6">Toys, Kids & Baby</option>
<option value="7">Clothing & Jewelry</option>
<option value="8">Sports & Outdoors</option>
<option value="9">Automotive & Industrial</option>
</mobiscroll.Select>
</label>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<label>
Group options
<mobiscroll.Select
select="multiple"
label="Name"
group={true}
groupLabel=" "
value={[1,2,9,196,200,1008,1009]}
>
<optgroup label="A">
<option value="0">Adaline Shiver</option>
<option value="1">Adella Cornell</option>
<option value="2">Adolph Scriber</option>
<option value="3" disabled>Adrianna Merritt</option>
<option value="4" disabled>Adrianne Marotta</option>
</optgroup>
<optgroup label="B">
<option value="78">Barbara Mackay</option>
<option value="79">Barbera Phu</option>
<option value="80">Barbie Kaczorowski</option>
<option value="81">Barney Flurry</option>
<option value="82">Beatriz Remer</option>
</optgroup>
// Showing partial data. Download full source.
</mobiscroll.Select>
</label>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<label>
Desktop
<mobiscroll.Select
select="multiple"
value={[3,4]}
touchUi={false}
>
<option value="1">Books</option>
<option value="2">Movies, Music & Games</option>
<option value="3">Electronics & Computers</option>
<option value="4">Home, Garden & Tools</option>
<option value="5">Health & Beauty</option>
<option value="6">Toys, Kids & Baby</option>
<option value="7">Clothing & Jewelry</option>
<option value="8">Sports & Outdoors</option>
<option value="9">Automotive & Industrial</option>
</mobiscroll.Select>
</label>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - Group options
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 inputStyle="box" labelStyle="stacked">
<div className="mbsc-grid mbsc-form-grid">
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Use it on desktop</mobiscroll.FormGroupTitle>
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<label>
Group select
<mobiscroll.Select
display="bubble"
touchUi={false}
>
<optgroup label="USA">
<option value="1">Atlanta</option>
<option value="2">Boston</option>
<option value="3">Chicago</option>
<option value="4">Los Angeles</option>
<option value="5">New York</option>
<option value="6">San Francisco</option>
</optgroup>
<optgroup label="UK">
<option value="7">Bath</option>
<option value="8">Bristol</option>
<option value="9">Cambridge</option>
<option value="10">London</option>
<option value="11">Leeds</option>
<option value="12">Manchester</option>
<option value="13">Newcastle</option>
<option value="14">Oxford</option>
</optgroup>
<optgroup label="China">
<option value="15">Beijing</option>
<option value="16">Chongqing</option>
<option value="17">Shanghai</option>
<option value="18">Shenzhen</option>
<option value="19">Tianjin</option>
</optgroup>
</mobiscroll.Select>
</label>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<label>
Group wheel
<mobiscroll.Select
display="bubble"
group={true}
touchUi={false}
>
<optgroup label="USA">
<option value="1">Atlanta</option>
<option value="2">Boston</option>
<option value="3">Chicago</option>
<option value="4">Los Angeles</option>
<option value="5">New York</option>
<option value="6">San Francisco</option>
</optgroup>
<optgroup label="UK">
<option value="7">Bath</option>
<option value="8">Bristol</option>
<option value="9">Cambridge</option>
<option value="10">London</option>
<option value="11">Leeds</option>
<option value="12">Manchester</option>
<option value="13">Newcastle</option>
<option value="14">Oxford</option>
</optgroup>
<optgroup label="China">
<option value="15">Beijing</option>
<option value="16">Chongqing</option>
<option value="17">Shanghai</option>
<option value="18">Shenzhen</option>
<option value="19">Tianjin</option>
</optgroup>
</mobiscroll.Select>
</label>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<label>
Group
<mobiscroll.Select
display="bubble"
select="multiple"
group={true}
value={[1,2,9,196,200,1008,1009]}
touchUi={false}
>
<optgroup label="A">
<option value="0">Adaline Shiver</option>
<option value="1">Adella Cornell</option>
<option value="2">Adolph Scriber</option>
<option value="3" disabled>Adrianna Merritt</option>
<option value="4" disabled>Adrianne Marotta</option>
</optgroup>
<optgroup label="B">
<option value="78">Barbara Mackay</option>
<option value="79">Barbera Phu</option>
<option value="80">Barbie Kaczorowski</option>
<option value="81">Barney Flurry</option>
<option value="82">Beatriz Remer</option>
</optgroup>
// Showing partial data. Download full source.
</mobiscroll.Select>
</label>
</div>
</div>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Use it on mobile</mobiscroll.FormGroupTitle>
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<label>
Group select
<mobiscroll.Select
display="bubble"
>
<optgroup label="USA">
<option value="1">Atlanta</option>
<option value="2">Boston</option>
<option value="3">Chicago</option>
<option value="4">Los Angeles</option>
<option value="5">New York</option>
<option value="6">San Francisco</option>
</optgroup>
<optgroup label="UK">
<option value="7">Bath</option>
<option value="8">Bristol</option>
<option value="9">Cambridge</option>
<option value="10">London</option>
<option value="11">Leeds</option>
<option value="12">Manchester</option>
<option value="13">Newcastle</option>
<option value="14">Oxford</option>
</optgroup>
<optgroup label="China">
<option value="15">Beijing</option>
<option value="16">Chongqing</option>
<option value="17">Shanghai</option>
<option value="18">Shenzhen</option>
<option value="19">Tianjin</option>
</optgroup>
</mobiscroll.Select>
</label>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<label>
Group wheel
<mobiscroll.Select
display="bubble"
group={true}
>
<optgroup label="USA">
<option value="1">Atlanta</option>
<option value="2">Boston</option>
<option value="3">Chicago</option>
<option value="4">Los Angeles</option>
<option value="5">New York</option>
<option value="6">San Francisco</option>
</optgroup>
<optgroup label="UK">
<option value="7">Bath</option>
<option value="8">Bristol</option>
<option value="9">Cambridge</option>
<option value="10">London</option>
<option value="11">Leeds</option>
<option value="12">Manchester</option>
<option value="13">Newcastle</option>
<option value="14">Oxford</option>
</optgroup>
<optgroup label="China">
<option value="15">Beijing</option>
<option value="16">Chongqing</option>
<option value="17">Shanghai</option>
<option value="18">Shenzhen</option>
<option value="19">Tianjin</option>
</optgroup>
</mobiscroll.Select>
</label>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<label>
Group
<mobiscroll.Select
display="bubble"
select="multiple"
group={true}
value={[1,2,9,196,200,1008,1009]}
>
<optgroup label="A">
<option value="0">Adaline Shiver</option>
<option value="1">Adella Cornell</option>
<option value="2">Adolph Scriber</option>
<option value="3" disabled>Adrianna Merritt</option>
<option value="4" disabled>Adrianne Marotta</option>
</optgroup>
<optgroup label="B">
<option value="78">Barbara Mackay</option>
<option value="79">Barbera Phu</option>
<option value="80">Barbie Kaczorowski</option>
<option value="81">Barney Flurry</option>
<option value="82">Beatriz Remer</option>
</optgroup>
// Showing partial data. Download full source.
</mobiscroll.Select>
</label>
</div>
</div>
</mobiscroll.FormGroup>
</div>
</mobiscroll.Form>
);
}
}
<div id="content">
Select - Multi level hierarchy
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
const regData = {
url: 'https://trial.mobiscroll.com/regions/',
dataType: 'jsonp'
},
divData = {
url: 'https://trial.mobiscroll.com/divisions/',
dataType: 'jsonp'
},
subData = {
url: 'https://trial.mobiscroll.com/subdivisions/',
dataType: 'jsonp'
};
class App extends React.Component {
constructor(props) {
super(props);
this.emptyValue = { value: "", text: "", disabled: true };
this.state = {
regVal: '',
regData: this.getData(),
divVal: '',
divData: [this.emptyValue],
subVal: '',
subData: [this.emptyValue]
};
}
getData = (region, division) => {
let arr = [];
const regions = [
{ value: 1, text: 'Northeast' },
{ value: 2, text: 'Midwest' },
{ value: 3, text: 'South' },
{ value: 4, text: 'West' }
];
const divisions = {
1: [
{ value: 1, text: 'New England' },
{ value: 2, text: 'Mid-Atlantic' }
],
2: [
{ value: 3, text: 'East North Central' },
{ value: 4, text: 'West North Central' }
],
3: [
{ value: 5, text: 'South Atlantic' },
{ value: 6, text: 'East South Central' },
{ value: 7, text: 'West South Central' }
],
4: [
{ value: 8, text: 'Mountain' },
{ value: 9, text: 'Pacific' }
]
};
const subdivisions = {
1: [
{ value: 1, text: 'Connecticut' },
{ value: 2, text: 'Maine' },
{ value: 3, text: 'Massachusetts' },
{ value: 4, text: 'New Hampshire' },
{ value: 5, text: 'Rhode Island' },
{ value: 6, text: 'Vermont' }
],
2: [
{ value: 7, text: 'New Jersey' },
{ value: 8, text: 'New York' },
{ value: 9, text: 'Pennsylvania' }
],
3: [
{ value: 10, text: 'Illinois' },
{ value: 11, text: 'Indiana' },
{ value: 12, text: 'Michigan' },
{ value: 13, text: 'Ohio' }
],
4: [
{ value: 14, text: 'Wisconsin' },
{ value: 15, text: 'Iowa' },
{ value: 16, text: 'Kansas' },
{ value: 17, text: 'Minnesota' },
{ value: 18, text: 'Missouri' },
{ value: 19, text: 'Nebraska' },
{ value: 20, text: 'North Dakota' },
{ value: 21, text: 'South Dakota' }
],
5: [
{ value: 22, text: 'Delaware' },
{ value: 23, text: 'Florida' },
{ value: 24, text: 'Georgia' },
{ value: 25, text: 'Maryland' },
{ value: 26, text: 'North Carolina' },
{ value: 27, text: 'South Carolina' },
{ value: 28, text: 'Virginia' },
{ value: 29, text: 'District of Columbia' },
{ value: 30, text: 'West Virginia' }
],
6: [
{ value: 31, text: 'Alabama' },
{ value: 32, text: 'Kentucky' },
{ value: 33, text: 'Mississippi' },
{ value: 34, text: 'Tennessee' }
],
7: [
{ value: 35, text: 'Arkansas' },
{ value: 36, text: 'Louisiana' },
{ value: 37, text: 'Oklahoma' },
{ value: 38, text: 'Texas' }
],
8: [
{ value: 39, text: 'Arizona' },
{ value: 40, text: 'Colorado' },
{ value: 41, text: 'Idaho' },
{ value: 42, text: 'Montana' },
{ value: 43, text: 'Nevada' },
{ value: 44, text: 'New Mexico' },
{ value: 45, text: 'Utah' },
{ value: 46, text: 'Wyoming' }
],
9: [
{ value: 47, text: 'Alaska' },
{ value: 48, text: 'California' },
{ value: 49, text: 'Hawaii' },
{ value: 50, text: 'Oregon' },
{ value: 51, text: 'Washington' }
]
};
if (division) {
arr = subdivisions[division];
} else if (region) {
arr = divisions[region];
} else {
arr = regions;
}
return arr;
}
onRegSet = (ev, inst) => {
const div = this.div;
const sub = this.sub;
div.instance.settings.invalid.length = 0;
sub.instance.settings.invalid.length = 0;
div.instance.enable();
sub.instance.disable();
this.setState({
regVal: inst.getVal(),
divVal: '',
subVal: ''
});
setTimeout(() => {
this.setState({
divData: this.getData(inst.getVal()),
subData: [this.emptyValue]
});
});
}
onDivSet = (ev, inst) => {
const sub = this.sub;
sub.instance.settings.invalid.length = 0;
sub.instance.enable();
this.setState({
divVal: inst.getVal(),
subVal: ''
});
setTimeout(() => {
this.setState({
divVal: inst.getVal(),
subData: this.getData(null, inst.getVal())
});
});
}
onSubSet = (ev, inst) => {
this.setState({
subVal: inst.getVal()
});
}
onRemoteRegSet = (ev, inst) => {
const remoteDiv = this.remoteDiv;
const remoteSub = this.remoteSub;
remoteDiv.instance.settings.invalid.length = 0;
remoteSub.instance.settings.invalid.length = 0;
remoteDiv.instance.settings.data.url = 'https://trial.mobiscroll.com/divisions/?reg=' + inst.getVal();
remoteDiv.instance.enable();
remoteSub.instance.disable();
this.setState({
remoteRegVal: inst.getVal(),
remoteDivVal: '',
remoteSubVal: ''
});
setTimeout(() => {
remoteDiv.instance.refresh();
});
}
onRemoteDivSet = (ev, inst) => {
const remoteSub = this.remoteSub;
remoteSub.instance.settings.invalid.length = 0;
remoteSub.instance.settings.data.url = 'https://trial.mobiscroll.com/subdivisions/?div=' + inst.getVal();
remoteSub.instance.enable();
this.setState({
remoteDivVal: inst.getVal(),
remoteSubVal: ''
});
setTimeout(() => {
remoteSub.instance.refresh();
});
}
onRemoteSubSet = (ev, inst) => {
this.setState({
remoteSubVal: inst.getVal()
});
}
setRegRef = (comp) => {
this.reg = comp;
}
setDivRef = (comp) => {
this.div = comp;
}
setSubRef = (comp) => {
this.sub = comp;
}
setRemoteRegRef = (comp) => {
this.remoteReg = comp;
}
setRemoteDiv = (comp) => {
this.remoteDiv = comp;
}
setRemoteSub = (comp) => {
this.remoteSub = comp;
}
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>Data object</mobiscroll.FormGroupTitle>
<mobiscroll.Select
ref={this.setRegRef}
touchUi={false}
placeholder="Please Select..."
value={this.state.regVal}
data={this.state.regData}
onSet={this.onRegSet}
>
<mobiscroll.Input dropdown={true}>Region</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select
ref={this.setDivRef}
touchUi={false}
placeholder="Please Select..."
disabled={true}
value={this.state.divVal}
data={this.state.divData}
onSet={this.onDivSet}
>
<mobiscroll.Input dropdown={true} disabled={true}>Division</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select
ref={this.setSubRef}
touchUi={false}
placeholder="Please Select..."
disabled={true}
value={this.state.subVal}
data={this.state.subData}
onSet={this.onSubSet}
>
<mobiscroll.Input dropdown={true} disabled={true}>Subdivision</mobiscroll.Input>
</mobiscroll.Select>
</mobiscroll.FormGroup>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Remote data</mobiscroll.FormGroupTitle>
<mobiscroll.Select
ref={this.setRemoteRegRef}
touchUi={false}
placeholder="Please Select..."
value={this.state.remoteRegVal}
data={regData}
onSet={this.onRemoteRegSet}
>
<mobiscroll.Input dropdown={true}>Region</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select
ref={this.setRemoteDiv}
touchUi={false}
placeholder="Please Select..."
disabled={true}
value={this.state.remoteDivVal}
data={divData}
onSet={this.onRemoteDivSet}
>
<mobiscroll.Input dropdown={true} disabled={true}>Division</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select
ref={this.setRemoteSub}
touchUi={false}
placeholder="Please Select..."
disabled={true}
value={this.state.remoteSubVal}
data={subData}
onSet={this.onRemoteSubSet}
>
<mobiscroll.Input dropdown={true} disabled={true}>Subdivision</mobiscroll.Input>
</mobiscroll.Select>
</mobiscroll.FormGroup>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - Autocomplete
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
items: [{
text: "Abigail Hodges",
value: 1
}, {
text: "Adam Robertson",
value: 2
}, {
text: "Adrian Mackay",
value: 3
}, {
text: "Adrian Springer",
value: 4
},
// Showing partial data. Download full source.
]
};
}
remoteData = {
url: 'https://trial.mobiscroll.com/airports/',
remoteFilter: true,
dataType: 'jsonp',
processResponse: function (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>
<div className="mbsc-grid mbsc-form-grid">
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select display="center" filter={true} data={this.state.items}>
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">Local data</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select display="center" multiline={2} height={50} filter={true} data={this.remoteData}>
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">Remote data</mobiscroll.Input>
</mobiscroll.Select>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
.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;
}
Select - Data source
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
selected: 1,
selectedData: 1,
items: [{
value: 1,
text: 'Atlanta'
}, {
value: 2,
text: 'Berlin'
}, {
value: 3,
text: 'Boston'
}, {
value: 4,
text: 'Chicago'
}, {
value: 5,
text: 'London'
}, {
value: 6,
text: 'Los Angeles'
}, {
value: 7,
text: 'New York'
}, {
value: 8,
text: 'Paris'
}, {
value: 9,
text: 'San Francisco'
}]
};
}
set = (event, inst) => {
this.setState({
selected: inst.getVal()
});
}
setData = (event, inst) => {
this.setState({
selectedData: inst.getVal()
});
}
remoteData = {
url: 'https://trial.mobiscroll.com/content/languages.json',
dataType: 'json'
};
render () {
return (
<mobiscroll.Form inputStyle="box" labelStyle="stacked">
<div className="mbsc-grid mbsc-form-grid">
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<label>
HTML
<mobiscroll.Select value={this.state.selected} onSet={this.set} touchUi={false}>
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="8">Paris</option>
<option value="9">San Francisco</option>
</mobiscroll.Select>
</label>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<mobiscroll.Select
value={this.state.selectedData}
data={this.state.items}
onSet={this.setData}
touchUi={false}
>
<mobiscroll.Input inputStyle="box" labelStyle="stacked">Data object</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4">
<mobiscroll.Select
data={this.remoteData}
placeholder="Please select..."
maxWidth={300}
touchUi={false}
>
<mobiscroll.Input inputStyle="box" labelStyle="stacked">Remote data</mobiscroll.Input>
</mobiscroll.Select>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - Large datasource
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
data = {
url: 'https://trial.mobiscroll.com/content/names.json',
type: 'json'
}
render () {
return (
<mobiscroll.Form inputStyle="box">
<div className="mbsc-grid mbsc-form-grid">
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<label>
HTML
<mobiscroll.Select
display="bubble"
>
<option value="0">Adaline Shiver</option>
<option value="1">Adella Cornell</option>
<option value="2">Adolph Scriber</option>
<option value="3">Adrianna Merritt</option>
<option value="4">Adrianne Marotta</option>
<option value="5">Adrien Laycock</option>
<option value="6">Adrien Wiggins</option>
<option value="7">Agustin Vert</option>
<option value="8">Aisha Oritz</option>
<option value="9">Alaine Mikesell</option>
</mobiscroll.Select>
</label>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<label>
Remote
<mobiscroll.Select
display="bubble"
data={this.data}
placeholder="Please select..."
>
</mobiscroll.Select>
</label>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - Multiline select
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
mobile: 1,
desktop: 1,
items: [{
value: 1,
text: 'Percentage of assets covered by systematic risk assessments (>99)'
}, {
value: 2,
text: 'Number of personal vacancies in the security roles required for ISMS (Nil)'
}, {
value: 3,
text: 'Time taken to grant, change and remove access privileges (Max. 2 hours)'
}, {
value: 4,
text: 'Percentage of agents covered by an effective security awareness program (100%)'
}, {
value: 5,
text: 'Number of security access violations (<2)'
}, {
value: 6,
text: 'Number of emergency changes (<5)'
}, {
value: 7,
text: 'Number of security incidents involving malicious code (Max. 2)'
}, {
value: 8,
text: 'Number of systems where security requirements are not met (Max. 2)'
}, {
value: 9,
text: 'Average turnaround time of incidents (Max. 2 hours)'
}, {
value: 10,
text: 'Number of pending actions to meet response and recovery requirements (Max. 5)'
}, {
value: 11,
text: 'Number of scheduled internal audits not done (Max. 1)'
}, {
value: 12,
text: 'Number of scheduled penetration tests not done (Max. 1)'
}, {
value: 13,
text: 'Number of overdue actions arising out of audit reports (Max. 5)'
}, {
value: 14,
text: 'Number of changes not carried out as per change control procedure (Max. 1)'
}]
};
}
render() {
return (
<mobiscroll.Form>
<div className="mbsc-grid mbsc-form-grid">
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select
display="bubble"
multiline={3}
height={50}
value={this.state.mobile}
data={this.state.items}
>
<mobiscroll.Input inputStyle="box" labelStyle="stacked">Mobile</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select
display="bubble"
touchUi={false}
multiline={3}
height={50}
value={this.state.desktop}
data={this.state.items}
>
<mobiscroll.Input inputStyle="box" labelStyle="stacked">Mobile</mobiscroll.Input>
</mobiscroll.Select>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - Country Dropdown
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
lang: '',
theme: '',
themeVariant: ''
};
const group = {
groupWheel: false,
header: false
};
class App extends React.Component {
remoteData = {
url: 'https://trial.mobiscroll.com/content/countries.json',
type: 'json'
};
render () {
return (
<mobiscroll.Form className="mbsc-form-box">
<div className="mbsc-grid mbsc-form-grid">
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Use it on mobile</mobiscroll.FormGroupTitle>
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select display="bubble" data={this.remoteData} filter={true} group={this.group} width={400} placeholder="Please Select...">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">Filter</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select display="bubble" data={this.remoteData} group={true} width={[40, 240]} placeholder="Please Select...">
<mobiscroll.Input inputStyle="box">Group select</mobiscroll.Input>
</mobiscroll.Select>
</div>
</div>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Use it on desktop</mobiscroll.FormGroupTitle>
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select display="bubble" touchUi={false} data={this.remoteData} filter={true} group={this.group} width={400} placeholder="Please Select...">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">Filter</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.Select display="bubble" touchUi={false} data={this.remoteData} group={true} placeholder="Please Select...">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">Group select</mobiscroll.Input>
</mobiscroll.Select>
</div>
</div>
</mobiscroll.FormGroup>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
.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;
}
Select - Setting values
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
lang: ''
};
const customBtn = [
{
text: 'Custom',
handler: function (event, inst) {
inst.setVal([3, 4, 7], true, true, false, 1000);
}
},
'set',
'cancel'
];
const autoBtn = ['cancel'];
class App extends React.Component {
cities = [{
value: 1,
text: 'Atlanta'
}, {
value: 2,
text: 'Berlin'
}, {
value: 3,
text: 'Boston'
}, {
value: 4,
text: 'Chicago'
}, {
value: 5,
text: 'London'
}, {
value: 6,
text: 'Los Angeles'
}, {
value: 7,
text: 'New York'
}, {
value: 8,
text: 'Paris'
}, {
value: 9,
text: 'San Francisco'
}];
setLondon = () => {
this.inlineSelect.instance.setVal(5, true, true, false, 1000);
}
setParis = () => {
this.inlineSelect.instance.setVal(8, true, true, false, 1000);
}
setInlineSelect = (comp) => {
this.inlineSelect = comp;
}
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Controlling the default value</mobiscroll.FormGroupTitle>
<mobiscroll.Select data={this.cities}>
<mobiscroll.Input>Default</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select data={this.cities} defaultValue={6}>
<mobiscroll.Input>Custom default</mobiscroll.Input>
</mobiscroll.Select>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Setting a custom value</mobiscroll.FormGroupTitle>
<div className="mbsc-btn-group-block">
<mobiscroll.Button onClick={this.setLondon}>London</mobiscroll.Button>
<mobiscroll.Button onClick={this.setParis}>Paris</mobiscroll.Button>
</div>
<mobiscroll.Select ref={this.setInlineSelect} data={this.cities} display="inline" showInput={false}>
<mobiscroll.Input/>
</mobiscroll.Select>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Buttons API</mobiscroll.FormGroupTitle>
<mobiscroll.Select data={this.cities} select="multiple" buttons={customBtn}>
<mobiscroll.Input>Custom</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select data={this.cities} select="multiple" buttons={autoBtn}>
<mobiscroll.Input>Auto set</mobiscroll.Input>
</mobiscroll.Select>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - 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 {
constructor(props) {
super(props);
this.state = {
names: [{
value: 0,
group: 'A',
text: 'Adaline Shiver'
}, {
value: 1,
group: 'A',
text: 'Adella Cornell'
}, {
value: 2,
group: 'A',
text: 'Adolph Scriber'
},
{
value: 78,
group: 'B',
text: 'Barbara Mackay'
}, {
value: 79,
group: 'B',
text: 'Barbera Phu'
}, {
value: 80,
group: 'B',
text: 'Barbie Kaczorowski'
}, {
value: 81,
group: 'B',
text: 'Barney Flurry'
},
// Showing partial data. Download full source.
]
};
}
render() {
return (
<mobiscroll.Form rtl={true}>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>RTL enabled by default</mobiscroll.FormGroupTitle>
<mobiscroll.Select data={this.state.names} lang="ar">
<mobiscroll.Input>Arabic</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select data={this.state.names} lang="he">
<mobiscroll.Input>Hebrew</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select data={this.state.names} lang="fa">
<mobiscroll.Input>Farsi</mobiscroll.Input>
</mobiscroll.Select>
</mobiscroll.FormGroup>
<mobiscroll.FormGroup>
<mobiscroll.FormGroupTitle>Manually set RTL</mobiscroll.FormGroupTitle>
<mobiscroll.Select data={this.state.names} rtl={true} group={true}>
<mobiscroll.Input>RTL</mobiscroll.Input>
</mobiscroll.Select>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - Localization
import mobiscroll from '@mobiscroll/react';
import '@mobiscroll/react/dist/css/mobiscroll.min.css';
mobiscroll.settings = {
theme: '',
themeVariant: '',
display: 'bubble'
};
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
selected: 1,
items: [{
value: 1,
text: 'Atlanta'
}, {
value: 2,
text: 'Berlin'
}, {
value: 3,
text: 'Boston'
}, {
value: 4,
text: 'Chicago'
}, {
value: 5,
text: 'London'
}, {
value: 6,
text: 'Los Angeles'
}, {
value: 7,
text: 'New York'
}, {
value: 8,
text: 'Paris'
}, {
value: 9,
text: 'San Francisco'
}]
};
}
render() {
return (
<mobiscroll.Form className="md-localization">
<div className="mbsc-grid mbsc-form-grid">
<div className="mbsc-row">
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="en">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-en"></span>English
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="ar">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-ar"></span>Arabic
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="bg">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-bg"></span>Bulgarian
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="ca">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-ca"></span>Català
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="cs">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-cs"></span>Cestina
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="zh">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-zh"></span>Chinese
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="hr">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-hr"></span>Croatian
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="da">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-da"></span>Dansk
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="de">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-de"></span>Deutsch
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="en-UK">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-en-UK"></span>English (UK)
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="es">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-es"></span>Español
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="fr">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-fr"></span>Français
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="gr">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-gr"></span>Greek
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="hi">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-in"></span>Hindi
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="it">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-it"></span>Italiano
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="ja">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-ja"></span>Japanese
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="ko">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-kr"></span>Korean
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="lt">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-lt"></span>Lietuvių
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="hu">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-hu"></span>Magyar
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="nl">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-nl"></span>Nederlands
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="no">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-no"></span>Norsk
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="pl">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-pl"></span>Polski
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="pt-PT">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-pt-PT"></span>Português Europeu
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="pt-BR">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-pt-BR"></span>Pt. Brasileiro
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="ro">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-ro"></span>Româna
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="sr">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-sr"></span>Serbian
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="sk">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-sk"></span>Slovencina
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="fi">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-fi"></span>Suomi
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="sv">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-sv"></span>Svenska
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="th">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-th"></span>Thai
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="tr">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-tr"></span>Türkçe
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="ua">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-ua"></span>Ukrainian
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="vi">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-vi"></span>Vietnamese
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="ru">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-ru"></span>Русский
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="ru-UA">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-ru-UA"></span>Русский (UA)
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="he">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-he"></span>עברית
</mobiscroll.Input>
</mobiscroll.Select>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-4 mbsc-col-xl-3">
<mobiscroll.Select data={this.state.items} lang="fa">
<mobiscroll.Input inputStyle="box" placeholder="Please Select...">
<span className="flag flag-fa"></span>فارسی
</mobiscroll.Input>
</mobiscroll.Select>
</div>
</div>
</div>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
.md-localization span.flag {
width: 22px;
height: 15px;
position: absolute;
left: 1em;
z-index: 1;
top: 8px;
}
.mbsc-rtl .md-localization span.flag {
right: 1em;
}
.mbsc-ios .md-localization span.flag {
top: 15px;
}
.md-localization .flag~.mbsc-label {
margin-left: 38px;
}
.mbsc-rtl .md-localization .flag~.mbsc-label {
margin-right: 38px;
}
.md-localization img.flag {
width: 30px;
}
.md-localization .flag {
background: url(https://img.mobiscroll.com/demos/flags/flags_responsive.png) no-repeat;
background-size: 100%;
}
.md-localization .flag-en {
background-position: 0 93.38843%;
}
.md-localization .flag-ar {
background-position: 0 76.033058%;
}
.md-localization .flag-bg {
background-position: 0 9.090909%;
}
.md-localization .flag-ca {
background-position: 0 14.876033%;
}
.md-localization .flag-cs {
background-position: 0 21.900826%;
}
.md-localization .flag-zh {
background-position: 0 19.008264%;
}
.md-localization .flag-hr {
background-position: 0 38.429752%;
}
.md-localization .flag-da {
background-position: 0 23.140496%;
}
.md-localization .flag-de {
background-position: 0 22.31405%;
}
.md-localization .flag-en-UK {
background-position: 0 92.561983%;
}
.md-localization .flag-es {
background-position: 0 26.859504%;
}
.md-localization .flag-fr {
background-position: 0 29.752066%;
}
.md-localization .flag-gr {
background-position: 0 34.710744%;
}
.md-localization .flag-in {
background-position: 0 40.909091%;
}
.md-localization .flag-it {
background-position: 0 42.975207%;
}
.md-localization .flag-ja {
background-position: 0 44.214876%;
}
.md-localization .flag-kr {
background-position: 0 47.520661%;
}
.md-localization .flag-lt {
background-position: 0 52.066116%;
}
.md-localization .flag-hu {
background-position: 0 39.256198%;
}
.md-localization .flag-nl {
background-position: 0 65.289256%;
}
.md-localization .flag-no {
background-position: 0 65.702479%;
}
.md-localization .flag-pl {
background-position: 0 70.661157%;
}
.md-localization .flag-pt-PT {
background-position: 0 72.31405%;
}
.md-localization .flag-pt-BR {
background-position: 0 11.983471%;
}
.md-localization .flag-ro {
background-position: 0 74.380165%;
}
.md-localization .flag-sr {
background-position: 0 74.793388%;
}
.md-localization .flag-sk {
background-position: 0 79.752066%;
}
.md-localization .flag-fi {
background-position: 0 27.68595%;
}
.md-localization .flag-sv {
background-position: 0 77.68595%;
}
.md-localization .flag-th {
background-position: 0 85.950413%;
}
.md-localization .flag-tr {
background-position: 0 89.256198%;
}
.md-localization .flag-ua {
background-position: 0 91.735537%;
}
.md-localization .flag-vi {
background-position: 0 96.694215%;
}
.md-localization .flag-ru {
background-position: 0 75.206612%;
}
.md-localization .flag-ru-UA {
background-position: 0 10.743802%;
}
.md-localization .flag-he {
background-position: 0 40.495868%;
}
.md-localization .flag-fa {
background-position: 0 42.14876%;
}
Select - Event hooks
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 {
constructor(props) {
super(props);
this.state = {
selected: 1,
items: [{
value: 1,
text: 'Atlanta'
}, {
value: 2,
text: 'Berlin'
}, {
value: 3,
text: 'Boston'
}, {
value: 4,
text: 'Chicago'
}, {
value: 5,
text: 'London'
}, {
value: 6,
text: 'Los Angeles'
}, {
value: 7,
text: 'New York'
}, {
value: 8,
text: 'Paris'
}, {
value: 9,
text: 'San Francisco'
}]
};
}
show = () => {
this.select.instance.show();
}
clear = () => {
this.select.instance.clear();
}
setRef = (comp) => {
this.select = comp;
}
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
}
onFilter = (event, inst) => {
// Your custom event handler goes here
}
onChange = (event, inst) => {
// Your custom event handler goes here
}
render() {
return (
<mobiscroll.Form>
<mobiscroll.FormGroup>
<mobiscroll.Select
ref={this.setRef}
filter={true}
value={this.state.selected}
data={this.state.items}
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}
onFilter={this.onFilter}
onChange={this.onChange}
placeholder="Please Select..."
>
<mobiscroll.Input inputStyle="box" labelStyle="stacked">Select</mobiscroll.Input>
</mobiscroll.Select>
<div className="mbsc-btn-group">
<mobiscroll.Button onClick={this.clear}>Clear</mobiscroll.Button>
<mobiscroll.Button onClick={this.show}>Show</mobiscroll.Button>
</div>
</mobiscroll.FormGroup>
</mobiscroll.Form>
);
}
}
<div id="content"></div>
Select - Theming capabilities
The look and feel of the select 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 {
constructor(props) {
super(props);
this.state = {
items: [{
value: 1,
text: 'Atlanta'
}, {
value: 2,
text: 'Berlin'
}, {
value: 3,
text: 'Boston'
}, {
value: 4,
text: 'Chicago'
}, {
value: 5,
text: 'London'
}, {
value: 6,
text: 'Los Angeles'
}, {
value: 7,
text: 'New York'
}, {
value: 8,
text: 'Paris'
}, {
value: 9,
text: 'San Francisco'
}]
};
}
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.Select theme="ios" themeVariant="light" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Light</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select theme="ios" themeVariant="dark" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Dark</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select theme="ios-gray" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Custom</mobiscroll.Input>
</mobiscroll.Select>
</mobiscroll.FormGroup>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Material Theme</mobiscroll.FormGroupTitle>
<mobiscroll.Select theme="material" themeVariant="light" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Light</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select theme="material" themeVariant="dark" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Dark</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select theme="material-indigo" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Custom</mobiscroll.Input>
</mobiscroll.Select>
</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.Select theme="windows" themeVariant="light" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Light</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select theme="windows" themeVariant="dark" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Dark</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select theme="windows-yellow" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Custom</mobiscroll.Input>
</mobiscroll.Select>
</mobiscroll.FormGroup>
</div>
<div className="mbsc-col-sm-12 mbsc-col-md-6">
<mobiscroll.FormGroup inset>
<mobiscroll.FormGroupTitle>Mobiscroll Theme</mobiscroll.FormGroupTitle>
<mobiscroll.Select theme="mobiscroll" themeVariant="light" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Light</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select theme="mobiscroll" themeVariant="dark" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Dark</mobiscroll.Input>
</mobiscroll.Select>
<mobiscroll.Select theme="mobiscroll-lime" display="bubble" touchUi={false} data={this.state.items} placeholder="Please Select...">
<mobiscroll.Input>Custom</mobiscroll.Input>
</mobiscroll.Select>
</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/9 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! 👍