npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@playwright-labs/slack-buildkit

v1.0.0

Published

Build interactive Slack Block Kit messages with React (and soon Lit, Vue, Angular) components

Readme

@playwright-labs/slack-buildkit

Build interactive Slack Block Kit messages using TypeScript builder functions or React JSX components.

The package is framework-agnostic at its core — React support ships out of the box, with Lit, Vue, and Angular planned.


Installation

pnpm add @playwright-labs/slack-buildkit
# React support (optional)
pnpm add react

Two APIs, one output

1. Builder functions (no framework required)

import { header, section, divider, actions, button, render, message } from "@playwright-labs/slack-buildkit";

const blocks = render([
  header("🚀 Deployment Complete"),
  section("*Environment:* Production\n*Version:* v1.4.2"),
  divider(),
  actions([
    button("View Logs", { action_id: "view_logs", style: "primary", url: "https://logs.example.com" }),
    button("Rollback", { action_id: "rollback", style: "danger" }),
  ]),
]);

// `blocks` is a flat SlackBlock[] ready to POST
const payload = message(blocks, { text: "Deployment complete" });

2. React JSX (custom JSX runtime — no React DOM, no virtual DOM)

Configure tsconfig.json:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "@playwright-labs/slack-buildkit/react"
  }
}

Or use the pragma comment per file:

/** @jsxImportSource @playwright-labs/slack-buildkit/react */
import {
  Blocks, Header, Section, Divider, Actions, Button, Context,
} from "@playwright-labs/slack-buildkit/react";
import { render } from "@playwright-labs/slack-buildkit";

function DeployReport({ env, version }: { env: string; version: string }) {
  return (
    <Blocks>
      <Header>🚀 Deployment Complete</Header>
      <Section>{`*Environment:* ${env}\n*Version:* ${version}`}</Section>
      <Divider />
      <Actions>
        <Button action_id="view_logs" style="primary" url="https://logs.example.com">
          View Logs
        </Button>
        <Button action_id="rollback" style="danger">
          Rollback
        </Button>
      </Actions>
      <Context>Deployed by CI • {new Date().toUTCString()}</Context>
    </Blocks>
  );
}

const blocks = render(<DeployReport env="production" version="v1.4.2" />);

The JSX compiles to plain function calls — there is no React reconciler, no virtual DOM, no react-dom. Components are called synchronously and return Block Kit JSON objects directly.


Sending the message

slack-buildkit is transport-agnostic — it only builds the payload. Use @playwright-labs/reporter-slack for Playwright test reports, or send manually:

Incoming Webhook:

await fetch(process.env.SLACK_WEBHOOK_URL!, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(payload),
});

Slack Web API:

await fetch("https://slack.com/api/chat.postMessage", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.SLACK_BOT_TOKEN}`,
  },
  body: JSON.stringify({ ...payload, channel: "C12345" }),
});

API Reference

Blocks

| Function | Description | |----------|-------------| | section(text, options?) | Text section, optional fields and accessory | | fields(items, block_id?) | Section with only fields (no main text) | | header(text, block_id?) | Large bold header text | | divider(block_id?) | Horizontal rule | | image(url, alt, options?) | Image block | | actions(elements, block_id?) | Container for interactive elements | | context(elements, block_id?) | Small contextual text or images | | input(label, element, options?) | User input block | | richText(elements, block_id?) | Rich text formatting | | video(title, url, thumb, alt, options?) | Embedded video |

Interactive elements

| Function | Description | |----------|-------------| | button(text, options?) | Clickable button (style: "primary" \| "danger") | | staticSelect(placeholder, options, options?) | Single-item dropdown | | multiStaticSelect(placeholder, options, options?) | Multi-item dropdown | | overflow(options, action_id?, confirm?) | Overflow menu | | datepicker(options?) | Date picker | | timepicker(options?) | Time picker | | radioButtons(options, options?) | Radio button group | | checkboxes(options, options?) | Checkbox group | | plainTextInput(options?) | Single/multi-line text field | | imageElement(url, alt) | Inline image element |

Composition objects

| Function | Description | |----------|-------------| | plainText(text, emoji?) | plain_text object | | mrkdwn(text, verbatim?) | mrkdwn object | | text(value, type?) | Either type, defaults to mrkdwn | | option(label, value, desc?, url?) | Select/radio/checkbox option | | optionGroup(label, options) | Group of options | | confirm(title, text, confirm?, deny?, style?) | Confirmation dialog |

Render utilities

| Function | Description | |----------|-------------| | render(value) | Flatten SlackBlock \| SlackBlock[] \| nullSlackBlock[] | | message(blocks, options?) | Wrap blocks into a SlackMessage payload object |

React components

All block builders have a matching JSX component. Import from @playwright-labs/slack-buildkit/react:

<Blocks>, <Header>, <Section>, <Divider>, <Image>, <Actions>, <Context>, <Input>, <Button>, <StaticSelect>, <MultiStaticSelect>, <Overflow>, <Datepicker>, <Timepicker>, <RadioButtons>, <Checkboxes>, <PlainTextInput>, <ImageEl>, <Mrkdwn>, <PlainText>


Future framework support

The core builders (src/blocks.ts, src/elements.ts, etc.) are framework-agnostic. Framework-specific layers live under sub-paths:

| Sub-path | Status | |----------|--------| | @playwright-labs/slack-buildkit/react | ✅ Available | | @playwright-labs/slack-buildkit/lit | Planned | | @playwright-labs/slack-buildkit/vue | Planned | | @playwright-labs/slack-buildkit/angular | Planned |


License

MIT