section

look

A titled group of blocks.

Drawn

Due soon · 2

Renew the certexpires Friday3d
Rotate keysmonthly5d

The sample

site/src/kinds.rs:150–196

fn holders() -> Vec<Block> {
    let screen = Screen::new().id("today").title("Today").blocks(vec![
        text("today-hint", "3 builds ran, 1 needs you."),
        marked("today-deploy", "Deploy", "waiting on review", "", Tone::Needs),
    ]);
    let sheet = Sheet::new(
        "Add a check",
        vec![
            text("add-note", "Pick what runs on each push."),
            b!(Chips(
                Chips::new("runs", vec![chip("lint"), chip("test"), chip("bench")])
                    .id("add-runs")
                    .multi(true)
                    .selected(vec!["lint".to_string(), "test".to_string()])
            )),
            button("add-check", "add", ButtonStyle::Primary),
        ],
    )
    .id("add");
    let card = Card::new()
        .id("ship-notes")
        .kind(CardKind::Ask)
        .title("Ship the 0.4 notes?")
        .subtitle("asked 12 minutes ago · release")
        .badge(Label {
            text: "needs you".into(),
            tone: Some(Tone::Needs),
        })
        .buttons(vec![
            button("ship", "ship", ButtonStyle::Primary),
            button("hold", "hold", ButtonStyle::Plain),
            button("discard", "discard", ButtonStyle::Destructive),
        ]);
    vec![
        b!(Screen(screen)),
        section(
            "due",
            "Due soon · 2",
            vec![
                b!(Row(row("due-cert", "Renew the cert", "expires Friday", "3d"))),
                b!(Row(row("due-keys", "Rotate keys", "monthly", "5d"))),
            ],
        ),
        b!(Sheet(sheet)),
        b!(Card(card)),
    ]
}
{
  "blocks": [
    {
      "blocks": [
        {
          "id": "due-cert",
          "subtitle": "expires Friday",
          "title": "Renew the cert",
          "type": "row",
          "value": "3d"
        },
        {
          "id": "due-keys",
          "subtitle": "monthly",
          "title": "Rotate keys",
          "type": "row",
          "value": "5d"
        }
      ],
      "fallback": {
        "title": "Due soon · 2"
      },
      "header": "Due soon · 2",
      "id": "due",
      "type": "section"
    }
  ],
  "fallback": {
    "title": "screen"
  },
  "id": "section",
  "type": "screen"
}

Its fallback

What a renderer without section draws: a row from the fallback the block carries.
Due soon · 2

Style hooks

.b-sectionthe block
[data-block=section]every block of the kind
[data-id=due]this one block
Every page here is a blocks Screen, written by site::page: no hand-written HTML. Source: https://github.com/jirathip-dev/blocks