Skip to content

feat(block-kit): add block element examples - #227

Draft
zimeg wants to merge 2 commits into
mainfrom
block-element-examples
Draft

feat(block-kit): add block element examples#227
zimeg wants to merge 2 commits into
mainfrom
block-element-examples

Conversation

@zimeg

@zimeg zimeg commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

Adds dedicated block element examples under block-kit/, one file per element in src/block_elements/ with a matching test in tests/block_elements/.

Each example mirrors the JSON payload(s) from the element's docs.slack.dev reference page verbatim — hosted in a valid block (or input) where the element requires one, so each is a runnable payload rather than a bare element that can't be sent on its own. Where a reference page documents multiple payloads, every one is exemplified, and each test asserts the complete reference JSON.

This PR is the home for block elements the SDK implements; elements not yet implemented in the SDK are a separate follow-up.

Elements covered

Element Examples
Button 4 (regular, primary, link, hosted section + actions)
Checkboxes 1
Date picker 1
Datetime picker 1
Email input 1
File input 1
Image 3 (image_url, slack_file by url, slack_file by id)
Multi-select menu 5 (static, external, users, conversations, channels)
Number input 1
Overflow menu 1
Plain-text input 1
Radio button group 1
Select menu 5 (static, external, users, conversations, channels)
Time picker 1
URL input 1
Workflow button 1

Deferred

The button reference page also documents an agent_prompt variant (Slackbot hand-off), which the SDK does not yet implement — deferred here rather than shipping an example whose serialized payload wouldn't include the field.

Testing

ruff check, ruff format --check, mypy, and pytest all pass in block-kit/ (63 tests).

@zimeg zimeg added the enhancement New feature or request label Aug 28, 2026
@zimeg zimeg self-assigned this Aug 28, 2026
@zimeg
zimeg force-pushed the block-element-examples branch 2 times, most recently from 156b8aa to e41731b Compare August 28, 2026 05:20
Add examples for the block elements that the SDK already implements,
each in its own file under block-kit/src/block_elements/ with a
matching test. Every example mirrors the JSON payload(s) from the
element's docs.slack.dev reference page verbatim -- hosted in a valid
block (or input) where the element requires one -- so each is a
runnable payload rather than a bare element that cannot be sent on its
own. Where a reference page documents several payloads, every one is
exemplified (for instance the select and multi-select menus each cover
all five source variants, and the image element covers image_url and
both slack_file forms). Tests assert the complete reference JSON.

Covered: button, checkboxes, date picker, datetime picker, email
input, file input, image, multi-select menu, number input, overflow
menu, plain-text input, radio button group, select menu, time picker,
URL input, and workflow button. Descriptions match the docs copy
verbatim, following the existing blocks/ convention.

The button page also documents an agent_prompt variant (Slackbot
hand-off) that the SDK does not yet implement -- deferred here.

This PR is the home for block elements the SDK implements; elements not
yet implemented in the SDK are a separate follow-up.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Adds examples for documented block elements the palette was missing: the rich-text sub-elements (emoji, broadcast, color, date, link, text, channel, user, usergroup, team), the rich-text containers (section, list, quote, preformatted), the rich-text input, the context_actions elements (feedback buttons, icon button), and the URL source. Each ships a matching test asserting the complete reference JSON from docs.slack.dev, plus an alphabetical README entry.

Also reformats every existing block_elements test's expected payload to one key per line with a magic trailing comma so ruff format keeps them exploded.

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant