Access
Client Form Factor
To access the form factor of the hardware the browser is running
on, import the @salesforce/client/formFactor scoped module.
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.
html
<template>
<lightning-card title="formfactorName" icon-name="custom:custom19">
<div class="slds-m-around_medium">
<p>FormFactor:</p>
{formFactor}
</div>
</lightning-card>
</template>
js
import { LightningElement } from 'lwc';
import FORM_FACTOR from '@salesforce/client/formFactor'
export default class ClientFormFactor extends LightningElement {
formFactor = FORM_FACTOR;
}
xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>50.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
No comments:
Post a Comment