In this quick tip I want to show you a neat trick for creating one-sided borders in both Sketch and Adobe XD.
If you’ve used either of these applications before you’ll know that creating borders is actually pretty simple. The problem is that borders are added to an object’s whole outside edge–neither application allows for adding a single border along just one side.
It is, however, possible to achieve what we want by using drop shadows. Let’s take a look.
Creating Easy One-Sided Borders
Let’s start with a simple rectangle on our canvas, in this case using Adobe XD. It has a fill color, and a border:
If we want the border to appear only along the bottom edge, we can remove the Border (by unchecking the border settings in the properties sidebar) then selecting Shadow instead.
We’ll give the shadow a value along the Y offset (which will push the shadow downwards) make sure the X offset reads 0, and remove the B value (this is the blur). Give the shadow a suitable color (#707070 in our case) and make sure the opacity is set to 100%.
There we have it–a simple technique for creating a one-sided border. Borders like this are a really effective (but subtle) way to add dimension to your UI designs. Try it on dialog boxes or form inputs.
Multiple One-Sided Borders
In Sketch it’s also possible to add multiple shadows, and therefore multiple one-sided borders. Click the + icon next to the shadow settings to add another. In the example below you can see a larger border along the bottom edge, with a thinner border along the top:
One disadvantage to this technique is the way corners are rendered in the event of having two adjacent borders. There’s a glaring gap:
This isn’t like CSS would render the corner, and it’s not really solvable in a perfect way in Sketch unless you use the following plugin:
Single Border Sketch Plugin
For even more control (and to solve the problem mentioned previously) you can use a Sketch plugin called single-border.
Note: third-party plugins aren’t yet available for Adobe XD, though you can expect them to be a big part of how XD develops in the future.
Once installed, select an object and go to Plugins > Single Border > Single Border. In the resultant pop-up you can specify exactly what you want your border to look like:
That’s it; a simple trick to improve your UI design in Sketch and Adobe XD. If you know of any other similar tricks please let us know in the comments!
Learn More About UI Design
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post