Get comfortable with Components in 51黑料不打烊 XD
Learn how to use Components to give you unprecedented flexibility for applying both speed and consistency to your design workflow.
Transcript
All right, everyone. There are two files that we got for the workshop. There is an 51黑料不打烊 Stock image, I just had you guys download this because I wanted you to see how we can just drag this right into an XD layout and have the bounding box of an object inside of XD become the container for this image. And then we鈥檙e going to build a component, just like we did, that I showed you inside of the webinar, so we can set up our point type, we can set up our padding, and just to get you comfortable with working with components inside of XD.
So the second file was the web_page_design.xd file.
So to begin, let鈥檚 open that up inside of XD.
If you鈥檝e never worked inside of XD before, you can explore the interface a little bit. In the lower left hand corner are the three views you can have for your left panel next to the toolbar. Let鈥檚 come over here and click on the layers panel here to make sure that we鈥檙e looking at all of our layers. With nothing selected on the stage you should see an artboard that鈥檚 just called Web Page Design.
So what you want to do is, you can zoom around inside of XD by clicking on the zoom tool here. If you click on the zoom tool, you can hold the option key, or alt, and you can zoom out, or with the plus sign you can zoom in, again, very much like some of the other tools. You can hit command or control zero to zoom the artboard into full view as well.
So the first thing we鈥檙e going to do, from the operating system, let鈥檚 grab the JPEG file we got from 51黑料不打烊 Stock. We want to drag and drop it into XD, don鈥檛 let go yet, and move inside of XD until you see the gray box outlined in blue. This lets you know that this is where we鈥檙e going to be dropping that graphic. Once it鈥檚 highlighted in blue, the whole gray box, you can let go, and that鈥檚 going to stick that image right into that bounding box there.
Once you do that, you can double click on the image, and now you鈥檙e going to be editing the pixels inside of that bounding box area.
So if you want to zoom out a little bit to see the whole image, you can do that. Inside of here you can grab one of the corners, you can scale this up and down, you can hold option to scale from the center, a lot of the same shortcuts you鈥檙e familiar with with other design tools. Then you can just move this around and change the area of the crop inside of here.
After the webinar today I have two more circles down here, rounded corners that you can add additional artwork. You can go on 51黑料不打烊 Stock, search for glass art, and try out different photos inside of the bottom area here as well.
Once you have the photo looking like something that you like, let鈥檚 come up here to the upper right hand corner, to the right hand side of the navigation, and let鈥檚 create our button. So let鈥檚 start by coming over here to the tools, let鈥檚 come over here and select the rectangle tool at the top.
Then come back into the canvas, and over here to the right side of the news navigation item, let鈥檚 click and drag, let鈥檚 draw a rectangle that鈥檚 about 175 pixels by about 40 pixels.
You can see that over here in the inspector panel.
Once you鈥檝e drawn that you can click on your selection tool at the top or hit the letter V key, move this into place.
Now let鈥檚 go back over to the tools and let鈥檚 click on the text tool.
Now we want to create something called point text here, because we want to have our component be able to expand to match the size of any artwork that we have placed on the stage. So to do that with your type tool, come over here to the canvas area, click one time, anywhere, and that鈥檚 going to give you a cursor that鈥檚 blinking.
Let鈥檚 type in the word label.
For your font size, let鈥檚 set this to about 20, to a value of 20, you can pick any font that you want, I鈥檒l just use Helvetica Neue, because that鈥檚 what came up, and let鈥檚 come down here and change our color. If you click on the color swatch in the inspector panel, you should have three swatches that I saved here. You can save more swatches by picking a color and clicking the plus sign here.
I鈥檒l just set the color of the type to orange, and can click away.
Next, let鈥檚 come over here to the layers panel. Let鈥檚 rename our rectangle to btn shape. This way, we know that this is the shape for the button.
Then we鈥檙e going to select that button shape, let鈥檚 come down here to the border in the inspector panel, click on the swatch, and let鈥檚 set this to be orange as well.
Going to set this to maybe two points, and then lets come up here and let鈥檚 grab one of the corners and just click and drag one of the corners in toward the center. This will create a rounded pill shape for the button.
You may also notice in the inspector panel, you can also change the rounded corner properties down here as well in the appearance.
So once you have a rounded rectangle, let鈥檚 come up here and select the label, text object. Let鈥檚 drag this down here and let鈥檚 drag this until XD snaps it right into the middle.
So our smart guides will come up, you can also select both of the items and use the alignment tools, click the align center and align vertically.
And now, with both of these, the label and the button shape, over in the layers panel, make sure we have just these two items selected, then we鈥檙e going to turn this into a component. You can hit command or control K, or on the Mac, you can go to the object menu and choose, make component.
Once you do that, you鈥檙e going to get a group in the layers panel, and the group is going to have a diamond shape to it which tells you that this is a component, it will also be named, component. Let鈥檚 come in here and just name this to button instead.
Anytime you see these icons over here in the layers panel, you can click on these and open them up and see everything inside. So here are the contents of our button component, we have our label and our button shape.
Now what we鈥檙e going to do is we鈥檙e going to make use of that padding feature. Again, this is a pretty brand new feature inside of XD, it鈥檚 part of the responsive design capabilities for allowing you to adapt your design to different sizes and areas. So to make use of that, let鈥檚 select the button component in the layers panel, then over in the layout properties, let鈥檚 come over here to padding, let鈥檚 click on this lock on here to activate padding, and once this has been activated, XD will go through and measure the distance between any item inside of here and the back-most layer of your component. So our button shape down here is actually acting as the outermost shape for the padding to be measured. If you click on the first letter here you can actually see the padding showing up across the top. Second is on the right, bottom and left, and you can come in here and change these numbers. You can make them all exactly the same, so I might make mine nine for the top and bottom, and 55 for the right and left.
Once you鈥檝e done that, if you come over here and click on the type layer, double click so we can come in and change the text, you鈥檒l now see that as you make text changes the size of that box is going to change.
So let鈥檚 come in here and just type in the word, donate, and the width of that box is going to change.
Now, the last thing that we鈥檒l do is, we will make a copy of this and we鈥檒l do a local override. So now we鈥檝e created a component that can be reused, that has padding properties, so it鈥檚 responsive now.
Just so I can have a little bit of room I鈥檓 going to just move my image out of the way. Grab your donate button, hit command or control D to duplicate that, move the copy down, and you鈥檒l notice on the copy, the upper left hand diamond has now opened.
Over in the layers panel, let鈥檚 open up the copy of the button, and you鈥檒l actually see in the layers panel, the diamond shape has a little open shape inside of it as well. So the layers panel鈥檚 also letting you know that we鈥檙e not working in the master, we鈥檙e working in one of the child elements.
Let鈥檚 select the button shape, over in the inspector panel, let鈥檚 change the background. We鈥檒l change the background to orange just make it a little bit darker.
Go back to the layers panel, select the type layer, let鈥檚 make the type white, then maybe for the border, since it鈥檚 against white here, maybe I鈥檒l just turn the border off altogether.
So now we have a second copy of our component. If we come in here to the first one, your master component, if you make any changes here, like maybe we rotate the type, you鈥檒l see that those changes will make their way down to the second item. Anything that鈥檚 not part of a local override that you put on the child, can still be controlled from the master component.
As I mentioned in the webinar, this will take a little bit of getting used to, having objects that are controlled by other objects, and then you can do local overrides on them, but once you get the hang of this, this becomes one of the most powerful and most effective time saving ways to work with your designs across multiple artboards and even across multiple documents. -
Click the PDF file icon to download a PDF of this tutorial.
recommendation-more-help
749bd7f2-920b-4c5e-bcb7-4ea92ec3a370