Advertisement


Lists (similar to
  • ) in Sketch 3

  • Question

    I love that Sketch 3 uses CSS for lots of things, such as copying styles.

    Is there any way to create a list of items, sorta "linked" vertically so that if you change the padding/margin on them, they'll remain properly stacked?

    In HTML & CSS this would be a list of <li> tags that you can style, where if you adjust the padding or margin height on each, they'll all remain properly stacked/spaced.

    I never liked "distribute evenly" features, I'd much rather set my own padding & margins to be consistent with the rest of my design.

    2015/02/18
    1
    3
    2/18/2015 11:27:00 PM

    Accepted Answer

    Found out how using the Make Grid feature. Not perfect, but maybe the best we've got in Sketch 3.

    Let's say you want to make a menu, like a left side push menu.

    1) Make a shape (i.e. a rectangle) 2) Select it and choose Arrange > Make Grid 3) Set Rows to 5, Margin to 0px. Columns to 1. Click Make Grid.

    That will generate 5 rectangles with the same style and stack them vertically.

    Then when you want to change the padding/margin on them, you can select them all, change the height of all of them at the same time in the properties panel and you'll see them start to overlap. But then, with all of them still selected, repeat steps 2 & 3 above to do the "Make Grid" again and it will re-stack them vertically.

    Another tip: If you're doing a push menu, and you want single pixel borders between the items, do the steps above with a margin of -1px. Or if you just want a border-top, a great hack is to turn off the border and instead use a Shadow with X0, Y1, Blur0, Spread0. Then do the Make Grid with a margin of 1px (since the shadow takes 1px on the outside of the shape).

    None of this solves for alignment of the text on top of the rectangles though, anyone know how to make this answer better?

    2015/02/19
    0
    2/19/2015 11:31:00 PM