Skip to content

feat(block-kit): add card block example#96

Closed
zimeg wants to merge 1 commit into
mainfrom
feat/block-kit-card-example
Closed

feat(block-kit): add card block example#96
zimeg wants to merge 1 commit into
mainfrom
feat/block-kit-card-example

Conversation

@zimeg

@zimeg zimeg commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds a card block example to the Bolt for Python Block Kit examples, mirroring the official docs example (and the matching bolt-js-examples card example).

  • block-kit/src/blocks/card.py
    • example01() — a full card with an icon, title, subtitle, hero image, body, and an action button.
    • example02() — a minimal card with only a title and an action button (at least one of hero_image, title, actions, or body is required).
  • block-kit/tests/blocks/test_card.py — asserts each produced block deep-equals the expected literal.
  • block-kit/README.md — adds a Card bullet (alphabetical) with docs + implementation links.

Docs

https://docs.slack.dev/reference/block-kit/blocks/card-block

Notes

CardBlock.icon / CardBlock.hero_image are typed as Optional[str] in slack_sdk 3.42.0, but the documented example (and runtime serialization) uses image element objects. The example passes ImageElement to match the docs structure, with a narrow # type: ignore[arg-type] on those two arguments to satisfy mypy (the SDK type hint is narrower than the accepted input).

Validation

All four CI gates run locally against slack_sdk==3.42.0 (pinned in requirements.txt):

  • ruff check — passed (All checks passed!)
  • ruff format --diff --check — passed (34 files already formatted)
  • mypy ./**/*.py — passed (Success: no issues found in 34 source files)
  • pytest — passed (34 passed, including the 2 new test_card cases)

Co-Authored-By: Claude svc-devxp-claude@slack-corp.com

Mirror the official card block docs example in the Bolt for Python
Block Kit examples. example01 builds a full card (icon, title, subtitle,
hero image, body, action button); example02 shows a minimal card with
only a title and an action button.

Docs: https://docs.slack.dev/reference/block-kit/blocks/card-block

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg

zimeg commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

Closing as duplicate of #102 (same card block example) — consolidating to one PR per block.

@zimeg zimeg closed this Jun 27, 2026
@zimeg zimeg deleted the feat/block-kit-card-example branch June 27, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant