Lightning Component For Lightning Design System Tabs

Tabs - Lightning Design System
A tab keeps related content in a single container that is shown and hidden through navigation.
For more information please refer the following link.
Lightning Design System - Tabs
CODE :
Component :
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction">
    <aura:attribute name="SalesCloudURL" type="String" default="http://resources.docs.salesforce.com/208/14/en-us/sfdc/pdf/smb_sales_impl_guide.pdf"/>
   
    <aura:attribute name="ServiceCloudURL" type="String" default="https://resources.docs.salesforce.com/200/latest/en-us/sfdc/pdf/workbook_service_cloud.pdf"/>
    <aura:attribute name="MarketCloudURL" type="String" default="https://developers.gigya.com/display/GD/Salesforce+Marketing+Cloud"/>
    <aura:attribute name="AnalyticsCloudURL" type="String" default="https://resources.docs.salesforce.com/200/10/en-us/sfdc/pdf/analytics.pdf"/>
    <div class="slds-m-around--medium">
        <div class="slds-tabs--scoped">
            <ul class="slds-tabs--scoped__nav" role="tablist">
                <li aura:id="SalesId" class="slds-tabs--scoped__item slds-text-title--caps slds-active customClassForTab" title="Sales Cloud" role="presentation" ><a class="slds-tabs--scoped__link" href="javascript:void(0);" onclick="{!c.salesTab}" role="tab" tabindex="0" aria-selected="false" aria-controls="tab-default-1" id="sales_linking">Sales Cloud</a></li>
                <li aura:id="ServiceId" class="slds-tabs--scoped__item slds-text-title--caps customClassForTab" title="Service Cloud" role="presentation"><a class="slds-tabs--scoped__link" href="javascript:void(0);" onclick="{!c.serviceTab}" role="tab" tabindex="-1" aria-selected="true" aria-controls="tab-default-2" id="service_linking">Service Cloud</a></li>
                <li aura:id="MarketId" class="slds-tabs--scoped__item slds-text-title--caps customClassForTab" title="Market Cloud" role="presentation"><a class="slds-tabs--scoped__link" href="javascript:void(0);" onclick="{!c.marketTab}" role="tab" tabindex="-1" aria-selected="false" aria-controls="tab-default-3" id="market_linking">Market Cloud</a></li>
                <li aura:id="AnalyticsId" class="slds-tabs--scoped__item slds-text-title--caps customClassForTab" title="Analytics Cloud" role="presentation"><a class="slds-tabs--scoped__link" href="javascript:void(0);" onclick="{!c.analyticsTab}" role="tab" tabindex="-1" aria-selected="false" aria-controls="tab-default-3" id="Analytics_linking">Analytics Cloud</a></li>
            </ul>
            <div name="tabdataName" aura:id="SalesCloudId" id="tab-default-1" class="slds-tabs--scoped__content slds-show customClassForTabData" role="tabpanel" aria-labelledby="sales_linking">
                <p>"Sales Cloud" refers to the "sales" module in salesforce.com. </p>
                <p>It includes Leads, Accounts, Contacts, Contracts, Opportunities, Products, Price books, Quotes, and Campaigns (limits apply).</p>
                <p>It includes features such as Web-to-lead to support online lead capture, with auto-response rules.</p>
                <p>Below is the link to refer sales cloud.</p>
                <p><ui:outputURL value="{!v.SalesCloudURL}" label="SALES CLOUD PDF"/>
                </p>
            </div>
            <div name="tabdataName" aura:id="ServiceCloudId" id="tab-default-2" class="slds-tabs--scoped__content slds-hide customClassForTabData" role="tabpanel" aria-labelledby="service_linking">
                <p>Salesforce Service Cloud is a customer relationship management (CRM) platform for customer service and support, based on the company's CRM software for sales professionals.</p>
                <p>Below is the link to refer service cloud.</p>
                <p><ui:outputURL value="{!v.ServiceCloudURL}" label="SERVICE CLOUD PDF"/>
                </p>
            </div>
            <div name="tabdataName" aura:id="MarketCloudId" id="tab-default-3" class="slds-tabs--scoped__content slds-hide customClassForTabData" role="tabpanel" aria-labelledby="market_linking">
                <p>Salesforce Marketing Cloud is a customer relationship management (CRM) platform for marketers that allows them to create and manage marketing relationships and campaigns with customers.</p>
                <p>Below is the link to refer market cloud.</p>
                <p><ui:outputURL value="{!v.MarketCloudURL}" label="MARKET CLOUD PDF"/>
                </p>
            </div>
            <div name="tabdataName" aura:id="analyticsCloudId" id="tab-default-4" class="slds-tabs--scoped__content slds-hide customClassForTabData" role="tabpanel" aria-labelledby="Analytics_linking">
                <p>Cloud analytics is a service model in which elements of the data analytics process are provided through a public or private cloud.</p>
                <p>Cloud analytics applications and services are typically offered under a subscription-based or utility (pay-per-use) pricing model.</p>
                <p>Below is the link to refer market cloud.</p>
                <p><ui:outputURL value="{!v.AnalyticsCloudURL}" label="ANALYTICS CLOUD PDF"/>
                </p>
            </div>
        </div>
    </div>

</aura:component>
Controller :
({
    salesTab: function(component, event, helper) {
        helper.clearAll(component, event);
        //make Sales Cloud tab active and show tab data
        component.find("SalesId").getElement().className = 'slds-tabs--scoped__item slds-active customClassForTab';
        component.find("SalesCloudId").getElement().className = 'slds-tabs--scoped__content slds-show customClassForTabData';
    },
    serviceTab: function(component, event, helper) {
        helper.clearAll(component, event);
        //make Service Cloud tab active and show tab data
        component.find("ServiceId").getElement().className = 'slds-tabs--scoped__item slds-active customClassForTab';
        component.find("ServiceCloudId").getElement().className = 'slds-tabs--scoped__content slds-show customClassForTabData';
    },
    marketTab: function(component, event, helper) {
        helper.clearAll(component, event);
        //make Market Cloud tab active and show tab data
        component.find("MarketId").getElement().className = 'slds-tabs--scoped__item slds-active customClassForTab';
        component.find("MarketCloudId").getElement().className = 'slds-tabs--scoped__content slds-show customClassForTabData';
    },
    analyticsTab: function(component, event, helper) {
        helper.clearAll(component, event);
        //make Analytics tab active and show tab data
        component.find("AnalyticsId").getElement().className = 'slds-tabs--scoped__item slds-active customClassForTab';
        component.find("analyticsCloudId").getElement().className = 'slds-tabs--scoped__content slds-show customClassForTabData';
    },
   

})
Helper :
({
    clearAll: function(component, event) {
        // this method set all tabs to hide and inactive
        var getAllLI = document.getElementsByClassName("customClassForTab");
        var getAllDiv = document.getElementsByClassName("customClassForTabData");
        for (var i = 0; i < getAllLI.length; i++) {
            getAllLI[i].className = "slds-tabs--scoped__item slds-text-title--caps customClassForTab";
            getAllDiv[i].className = "slds-tabs--scoped__content slds-hide customClassForTabData";
        }
    }

})
OutCome :






Comments

Popular posts from this blog

Configur Docusign For Salesforce

How To Make DataTable Column Resizable

Lightning:recordForm - Lightning Data Service