As of today, there is a lwc module that you can import to get it:
import formFactorPropertyName from '@salesforce/client/formFactor'
formFactorPropertyName—A name that refers to the form factor of the
hardware running the browser. Possible values are:
- Large—A desktop client.
- Medium—A tablet client.
- Small—A phone client.
Pass the form factor to the getRecordCreateDefaults wire adapter to get the default layout and object information for creating a record.
import { getRecordCreateDefaults } from 'lightning/uiRecordApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
import FORM_FACTOR from '@salesforce/client/formFactor';
@wire(getRecordCreateDefaults, { objectApiName: ACCOUNT_OBJECT, formFactor: FORM_FACTOR})
accountDefaults;
SOURCE:
https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.create_client_form_factor
Hope that helps