function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
IamSRNIamSRN 

How to hide a Lightning Web Component (LWC) component if the current browser is mobile phone?

Hello,

I am using Progress Indicator component. But I want to hide this if user is accesing the page from mobile or tablet. What is the best way to do that? Thanks in adcance!!

( https://developer.salesforce.com/docs/component-library/bundle/lightning-progress-indicator/example)
Ankit RathorAnkit Rathor
Hi IamSRN,

Please try this code:

Aura Component

<aura:component  access="global" >
    {!$Browser.formFactor}
    <aura:if isTrue="{!$Browser.formFactor == 'DESKTOP'}">
        <c:progressBarComponent/> <!--LWC Component-->
    </aura:if>
</aura:component>

User-added image
User-added image
I hope it helps you.

Please let me know if you have any other query and If this solution is helpful then please mark it as Best Answer.

Thanks,
Ankit Rathor