isMobile

stablev1.0.0

Load isMobile to get a boolean response on the "mobile" status of user's device.

Overview

isMobile is a function that detects if user is on a mobile device or not and then be able to behave differently.

Usage

Dependencies

To get the isMobile working, include the dependencies in your project in the following order:

  1. npm
  2. JS
"design-system": "git+ssh://git@github.com/Selectra-Dev/design-system.git"
import isMobile from 'design-system/src/js/00-utilities/is-mobile';

Basic code

The function isMobile will return true or false depending on the user's device. You can then program a function based on the output resulting from isMobile.

Function call:

isMobile();

Here is a small example of what you could do:

if ( isMobile() ){
  // Do something accessible, useful and nice on mobile devices
} else {
  // Do something accessible, useful and nice on other devices
}