Skip to content

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

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

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

Conversation

@zimeg

@zimeg zimeg commented Aug 28, 2026

Copy link
Copy Markdown
Member

Adds dedicated block-element examples under the block-kit project, mirroring the reference payloads shown on the Block Kit block-elements reference pages on docs.slack.dev. Each documented reference payload becomes one exampleNN(), and every example ships a test asserting the complete serialized JSON (compared as parsed JSON trees, so key order does not matter), following the existing blocks/ convention.

This is the home for all implemented block elements; anything not yet covered is left as follow-up.

Elements added

New package elements under block-kit/src/main/java (+ matching tests). The package is named elements (not blockelements) so the layout reads blocks/ + elements/, matching the docs.slack.dev path structure where Blocks and Block elements are siblings under Block Kit — and matching the sibling bolt-js-examples and bolt-python-examples PRs. The SDK's own com.slack.api.model.block.element.BlockElements import is unaffected by the rename.

18 elements, 31 examples:

  • Button (4 examples): regular, primary, link, and buttons hosted in a section accessory + actions block
  • Select menu (5 examples): static, external, users, conversations, channels
  • Multi-select menu (5 examples): static, external, users, conversations, channels
  • Radio button group (1)
  • Date picker (1)
  • Time picker (1)
  • Datetime picker (1)
  • Email input (1)
  • URL input (1)
  • Number input (1)
  • File input (1)
  • Feedback buttons (1)
  • Icon button (1)
  • Overflow menu (1)
  • Plain-text input (1)
  • Rich text input (1)
  • Image (3 examples): image_url, slack_file by url, slack_file by id
  • Workflow button (1)

The block-kit/README.md gains a "Block elements" section listing each element with its docs link, tagline, and a link to the implementation.

Notes on hosting

Elements are shown inside their host block exactly as the reference pages present them: selects, radio buttons, overflow, image, and workflow button as a section accessory; date/time/datetime/email/url/number/file/plain-text inputs inside an input block. Where the docs present an element inside a modal view, the element is hosted in its natural block so the test can assert the full block payload.

Deferred (SDK gaps)

  • Checkboxes — the reference payload includes an option description typed as mrkdwn. The current model serializes an option description as plain_text, so the reference payload cannot be reproduced faithfully. Deferred until the description can carry a markdown text object.
  • Button agent_prompt variant — not represented in the current button model, so it is omitted from the button examples.

Testing

mvn spotless:check and mvn test both pass for the block-kit project (all example tests green).

Add dedicated block-element examples under the block-kit project,
mirroring the reference payloads on the docs.slack.dev block-elements
reference pages, with tests asserting the complete serialized JSON.

Elements: button, select menu (5 variants), multi-select menu (5
variants), radio buttons, date picker, time picker, datetime picker,
email input, URL input, number input, file input, overflow menu,
plain-text input, image (3 variants), workflow button.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg zimeg self-assigned this Aug 28, 2026
zimeg and others added 2 commits August 27, 2026 23:29
…and team elements

Adds the remaining documented block elements that the Java SDK models and
serializes to the exact reference payload:

- feedback_buttons and icon_button, each inside a context_actions block
- rich_text_input, inside an input block
- the team rich text element, added to the existing rich text block example

Each example ships a test asserting the complete reference JSON, and every new
element is listed in the README with its docs.slack.dev reference and tagline.

Deferred: url_source is not modeled by the Java SDK (no url source object or
task card block), so it is omitted rather than approximated.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Renames the package (and its src/test directories) from blockelements to
elements so the example layout reads blocks/ + elements/, matching the
docs.slack.dev path structure where Blocks and Block elements are siblings
under Block Kit, and aligning with the JS and Python example repos. Package
declarations and README implementation links follow; the docs URL slug
(block-elements, hyphenated) is unchanged, and the SDK's own
com.slack.api.model.block.element.BlockElements import is untouched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request java Pull requests that update java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant