Versatile React select component
Use it in responsive webapps and Ionic React projects with desktop and mobile optimized look & feel
Advanced select component for single and multiple value selection. Provides a great alternative to the native dropdown with enhanced UX. Renders a scroller on touch and a dropdown on desktop. Use it in custom event add/edit forms or on any input, field and form.
With the built-in filtering and templating capabilities create custom pickers.
The select can be picked up as part of Scheduling & calendaring and the Complete licenses.
Select - Mobile & Desktop usage
Use the select/combobox for both mobile and desktop or set it up responsively.
The main difference between the two rendering modes is how the picker is laid out. Set the touchUi
option to false
and the component shows up suitable for larger screens and pointer interaction while setting it to true
renders it suitable for touch screens.
Use it on an existing form field, custom input, native select or use it on Mobiscroll form fields. You can also embed it directly into your page. When linked to an input, the component will be shown on focus or when someone clicks on the field. Alternatively, you can leave the input editable and show the component only on a button click.
Select - Responsive behavior
The select has a liquid layout, which means it nicely adapts to its surroundings. There are times however when you would like to set up the component responsively.
Use the responsive
option to configure the picker and change the options based on the viewport width. There are five predefined breakpoints:
xsmall
- min-width: 0pxsmall
- min-width: 576pxmedium
- min-width: 768pxlarge
- min-width: 992pxxlarge
- min-width: 1200px- use
custom
for setting a custombreakpoint
It is a good idea to change the display
or controls
option to tailor the UX. This way you can have a bottom positioned calendar on mobile, a popover anchored to the input on tablet and desktop display on large screens.
Select - Understanding display modes
The select/combobox has five built-in display modes that can be controlled through the display
option:
top
- modal that slides down from the topbottom
- modal that slides up from the bottomcenter
- modal that shows up in the middle with a pop animationanchored
- modal that shows up anchored to an input or any dom elementinline
- embeddable picker that is rendered into the markup without its own modal
Use the touchUi
option to switch between touch optimized mobile rendering and pointer optimized desktop rendering. It can be dynamically switched with the help of the responsive
option.
The defaults change on a theme to theme basis. The ios
theme comes with bottom
on mobile and anchored
on desktop while the material
and windows
themes have center
on mobile and anchored
on desktop.
Select - Populating the picker
The select component takes care of rendering data in a scrollable and consumable way for the user. The date can be passed a couple of different ways:
- With the
data
option - If you want to load model data this is the way to do it. This is the way to populate the select if you want to create a custom item template. - Remote data - Load it through the
data
option from a remote api/data source.
Select - Templating
By default the select takes the item.text
and item.value
of the data
array items and populates the select. Besides the basic text/value interpretation you can write custom render functions for any custom markup printed as a scrollable list.
With the help of the renderItem
option you can write a function that returns the custom item markup. Any data
field can be used for the template. You'll also want to make sure that the itemHeight
is set accordingly.
Select - Country Dropdown
Use the select component as a country picker on mobile and desktop. You can add the dropdown to any input or use Mobiscroll input fields. If you don’t want to make it a dropdown, you can embed the picker inline right into a page.
Search is enabled through the filter
option.
In this example the data is loaded from a remote JSON in the following format: { “value”: “FJ”, “group”: “F”, “text”: “Fiji” }
and the flags are loaded from our server. For your implementation you should embed the list and flags into your own page.
For the image & text rendering use a custom item template.
Select - Image & text
An image & text value picker can be easily implemented by building a custom item template. Pass the items with its base properties, like text
and value
and all the custom properties needed to the data
array.
Select - Multiline select
Sometimes, the items of the select can get very long and they won't fit a single line. For those cases you can use the custom item templating and itemHeight
to solve the rendering problems.
Select - Single select
Single value selection is the default behavior of the picker. You can explicitly enable it by setting the selectMultiple
to false
.
You can dynamically switch between single and multiple select.
Select - Multiple select
Use it on mobile and desktop for listing different options with multiple select. It can be tied to an input, native select or rendered inline. Turn it on by setting selectMultiple
to true
.
As an alternative to the checkbox list it works great for category filtering... eg. e-commerce solutions.
Select - Group options
Enable group headers through the group
property of the options or the optgroup
of the native select.
Grouping works for both single and multiple select pickers.
Select - Filtering
Enable filtering by setting the filter
option to true
. Filtering happens on the client side by default, however remote filtering can be implemented using the onFilter
event.
Select - Multi level hierarchy
Multiple selects can be linked together as a hierarchy. A region > division > subdivision is a great example of such a hierarchy where each level is dynamically populated based on the selection of the previous level.
Select - Setting values
Values can change in a couple of different ways: through defaults, interacting with the UI or programmatically. The select defaults to null
(nothing is selected), which can be easily overridden with the defaultSelection
option.
The values are set by interacting with the component and making a selection or it can be done programmatically.
Use the buttons
option for showing/hiding set
, cancel
or add custom buttons.
Select - Disabled values
Enforcing validation is essential to a great UX. You can set an option to invalid through the disabled property:
data: [
...
{
text: 'Chicago',
value: 'chi',
disabled: true
}]
Having invalids set up correctly not just enhances the UX, but improves performance.
Select - Theming capabilities
The look and feel of the select can be deeply customized. There are four levels of customization:
- Base themes: Choose between iOS, Material and Windows.
- 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 from the header.
Select - Event hooks
The select ships with different event hooks for deep customization. Events are triggered through the lifecycle of the component where you can tie in custom functionality and code.
While users interact with the UI events like
onChange
, onSet
, onInit
... will be triggered.
Select - Localization
All components are fully localized. In case of the select this covers button copy, rtl and more. You can see how each example shows up by clicking on the small flag icon or checking the examples below.
Select - RTL support
RTL support is built in and can be explicitly controlled through the rtl
option. If not set, it is inherited from the locale
settings.
Looking for something you didn't see or have a sales question?
Ask us about it, we're here to help.