Usage of Design Attributes in Lightning Web Components

Usage of Design Attributes in Lightning Web Components
Usage of Design Attributes in Lightning Web Components

In my previous post, I have told you about how to navigate in the Lightning Web Components, now I’m going to tell you how to use Design Attributes in Lightning Web Components.

What is design attributes in Salesforce Lightning Framework?

When we need to expose an attribute of the component to the end user so that he can change/update the value of the component in builder tools like the Lightning App Builder, Community Builder, or Flow Builder. 

In Aura Framework, we were using <design:attribute> tag to create a design attribute. But in LWC we declare design attribute in the Component Configuration File (XML) with <targetConfigs> tag.

You need to defines the property in the component’s JavaScript class using the @api decorator.

So now let’s have a look at how you can create design attribute in LWC.


    <lightning-card title={cardTitle} icon-name="custom:custom14">
            <p>  Hello , {firstName} </p>


import { LightningElement, api } from 'lwc';
export default class design_attribute_lwc_example extends LightningElement {
    @api firstName ='Salesforce Ohana!';
    @api cardTitle ='Welcome to';


<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="" fqn="MyComponent">


        <targetConfig targets="lightning__HomePage,lightning__RecordPage">
            <property name="cardTitle" type="String" default="Salesforce Ohana!" label="Enter the Card title"/>
            <property name="firstName" type="String" default="Welcome to" label="Enter the First Name"/>

Parul Singh

I’m a Salesforce Certified Service Cloud Consultant, Certified Administrator & Certified Platform Developer. I have 2 years of experience, currently working on Field Service Lightning, Lightning Flows and Learning Lightning Web Component. I was featured in the top Salesforce Bloggers of 2018 by

You may also like...