Adobe XD web component plug-in¶
How to use this Plug-In correctly¶
Step 1: Groups and elementboxes¶
A. Make necessary groups
To make sure, that buttons and inputfields with a placeholder will implemented correctly, you have to group the rectangle and the textfield together:
1. Select the two elements you want to group
- select the first element
- press
Shift
- select the other element
2. Group them together
- right click on one of the selected elements
- choose Group
- OR: use the shortcut:
Crtl + G

Selecting and grouping the elements (ref: 1. + 2.)
3. Name the group
double click on the name of your group (e.g Group 1)you find your elements in the list on the left hand side
- choose a unique name that includes the function of this group - button or input(e.g: my_input - for an inputfield OR my_button - for a button)

Rename the group (ref: 3.)
Hint
If you want to design your own logos or icons you also have to group all elements the logo/incon consists and the name of the group must also include the keyword: img
B. Resize the elementboxes
Make sure that the elementboxes from your elements - especially from the textfield are as big as the text it self. Otherwise the margin will not calculate correctly.
Adjust the elementboxes.
Step 2: Name your elements¶
Important
all names have to be one word or seperated with a _ !
Adobe element | HTML element | keyword [1] |
rectangle + text (group) | button | button |
rectangle + text (group) | input with placeholder | input |
rectangle | inputfield | input |
rectangle | checkbox | checkbox |
rectangle | radiobutton | radiobutton |
line | line | line |
text [2] | list | list |
text | link | link |
images/logos [3] | image | img |
[1] | the keyword has to be includen in the elementname |
Hint
Examples:
Example how to name your elements correctly.
[2] | Illustration: how to make a list: |
Example how to make a list.
[3] | Illustration: How to name a image: |
Example how to name a image
Step 3: Select your Items¶
For now it is important to select the elements from top left to bottom right:
How to select your elements
Step 4: Use the plugin¶
After selecting all elements, go to your plugin selection and choose “Export as Webcomponent”.
Where to find the plugin
A pop-up will appeare and you first have to enter a name for your component.
Hint
Make sure you don’t forget the “-” in the name.
Than you are able to select a folder to save your component.
Plugin pop-up
How to deal with the exported files¶
How to import the exported files into your web application¶
In your folder, you selected for saving the export, you will find the .js file, the .css file, a index.html file, an other .html file and a material folder, where all your images will be saved.
- Copy those three things: the js file, the css file and the material folder
- Paste them into your web application
- Make sure you copy the images as well and not only the folder (otherwise drag the image in the copyed folder)
- Read the TO-DO in the js-file
- Place your HTML tag [1] on the position you want to have your component on your Website
Hint
[1] | with a webcomponent you will create your own tag, so you may have to add the tag to your custom tags before it will work correctly. |
Handle the .js file¶
In the .js file you will finde:
1. The HTML structur of your component
HTML structur in the js file.
2. The component class
Below the html-template you will find the component class, where you can add eventlistener to your buttons or other elements you want to interact with.
- call the choosen element by the ID-name and add an eventlistener in the provided connectedCallback-function:
connectedCallback() { this.shadowRoot.querySelector('#id-name').addEventListener('click',() => this.function()); }
- define your function you called in den lambda-expression:
function() { // write your code here... }
- remove the eventlistener in the disconnectedCallback-function.
disconnectedCallback() { this.shadowRoot.querySelector('#id-name').removeEventListener(); }
explaination how to add events.
Hint
Handle the .css file¶
The .css file includes all the information about the style for every element.
Ctrg + Alt + L
Hint
Why this index.html?¶
Extra .html file¶
Hint
Web components¶
What are web components?¶
Web components are a set of web platform APIs that allow you to create new custom, reusable, encapsulated HTML tags to use in web pages and web apps. They will work across modern browsers, and can be used with any JavaScript library or framework that works with HTML.
FAQs¶
1. Why do I not see the filepath?¶
- Your element names aren’t written correctly.Please check step 2.
- You forgot to select the elements you want to export.To do this in the right way, please check step 3.
- You didn’n name your component correctly / The “-” is missing in the component name.
- Other reasons, in this case please write an e-mail to the support. Thank you.
2. Why does my export looks different than in Adobe XD?¶
- Little differences are common.
- Sometimes it’s helpful to select the elements and do the export again.
- You selected the elements wrong.Please check step 3.
- Your element names aren’t written correctly, so the styling can’t be taken over.Please check step 2.
- The margin couldn’t be calculated correctly.May your elementboxes are bigger than for example the text.Please check step 1 / B.
- Your elements overlaping or aren’t in one line with eachother.In this case there is no solution - this arrangement of the elements isn’t supported yet.Please write an e-mail to the support with the subject: “individual arrangement of elements”.
- Other reasons, in this case please write an e-mail to the support. Thank you.