Automatic variable border radius with multiple shadows

Hi,

I’ve thought about this a bunch and I was not able to come up with a solution. Is there any way to create this design with variable border radius and shadows in such a way that when items are added to the top or bottom, the radius readjusts?

Currently, I have a separate layer style for the first and last item that I manually apply, but that is definitely inelegant and error-prone.

Applying the border radius to the frame itself would work but the shadows make that difficult. A single one works fine:

But as soon as you add two, this happens:

This means that I have to apply the shadows, and by extension the border radius to the individual items instead of the whole frame.

Is this a bug? Is it an unfortunate quirk of how shadows work? If so, what else could I do?

Thanks in advance :slight_smile:

Hi there. :waving_hand:
You can easily do this with Stacks and Frames. Basically, apply a small rounding to each of the individual items that you want to represent your row, wrap them in a Stack, and then apply a larger rounding to that Stack. Then you can add a shadow to the Stack itself.
Here’s a quick demo and example file.


rounded-stack.sketch (9.4 KB)

Hi,

Sorry, I think I should have been more clear. This works with one shadow, but to recreate the border effect, I have to use two. And when using two shadows, the second shadow gets applied in such a way that it fills the gaps as well, as if it isn’t cast by individual items, but something invisible between all of them:

Could this be a bug, then?

In your example:

Indeed, you’re right. Adding a second shadow does fill in the gaps there. Let me take this issue to the development team to see what they can make of this situation. Apologies in the meantime. :folded_hands:

1 Like

I’m back with an update. Unfortunately, yes, this is a quirk/limitation of how Shadows operate at present. A Group – or a Frame that’s acting like a Group – can only render one Shadow. Add another Shadow and the Frame will switch to rendering Shadows like on a shape.
With the setup that you are trying to create, requiring both a Border and Shadow, it would seem that you will have to manually adjust the top and bottom rows separately.
Apologies for this, but I will file this issue in the Customer Requests repo for consideration. :folded_hands:

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.