How to make each grid cell take up all available space?

Note that this only works from 0.12.0 onwards, which is still in its testing phase, as rect doesn’t accept fraction type in its height in previous versions.

In 0.11.1 you can add #v(1fr) at the end of each rect to achieve the same effect:

#set page(width: 300pt, height: 200pt)

#set rect(
  inset: 8pt,
  fill: rgb("e4e5ea"),
  width: 100%,
  radius: 5pt,
)

#show grid.cell: it => {
  rect(it+v(1fr))
}

#grid(
  columns: (1fr, 1fr, 1fr),
  rows: 1fr,
  gutter: 3pt,
  grid.cell(rowspan: 2, [
    I don't want to use `fill` provided by `grid` because I can not get nice `radius`.\
    This is 2 rows.
  ]),
  [How to make this expand?],
  [I want each cell to take up all available space.],
  [I don't want to hard code heights of each row.],
  [How to make this expand?],
)
2 Likes