Skip to content

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

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

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

Conversation

@zimeg

@zimeg zimeg commented Jun 27, 2026

Copy link
Copy Markdown
Member

Summary

Adds a Block Kit card block example to the block-kit showcase, mirroring the official docs example. The example is constructed using the SDK-provided CardBlock type (imported from slack_sdk.models.blocks) with an icon, title, subtitle, hero image, body, and an action button.

  • block-kit/src/blocks/card.pyexample01() returning a CardBlock
  • block-kit/tests/blocks/test_card.py — asserts the produced block deep-equals the expected JSON literal
  • block-kit/README.md — adds the Card bullet (alphabetical, with docs + implementation links)

Docs

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

The example JSON mirrors the docs page (icon, title "Lumon Industries", subtitle, hero image, body, single action button).

Notes

  • icon and hero_image are passed as ImageElement instances (matching the neighboring carousel.py example and the docs JSON, which render image element objects). The installed slack_sdk 3.42.0 type stub annotates these params as str, so a targeted # type: ignore[arg-type] is applied — runtime serialization produces the correct {"type": "image", ...} output, verified by the test.

Validation

Ran the repo's CI-equivalent checks for the block-kit showcase (Python 3.13, slack_sdk 3.42.0):

  • ruff check — passed
  • ruff format --diff --check — passed (34 files already formatted)
  • mypy ./**/*.py — passed (no issues in 34 source files)
  • pytest — passed (33 passed, including the new test_card.py)

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

🤖 Generated with Claude Code

Add a Block Kit card block example mirroring the official docs example,
constructed with the slack_sdk CardBlock type (icon, title, subtitle,
hero image, body, and an action button). Includes a test asserting the
produced block matches the expected JSON and a README bullet.

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

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
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