Installation
Add @nkootstra/block-kit to a React 18 or 19 app, with its stylesheet and fonts.
The package needs React 18 or 19. It works with any bundler that can import CSS: Vite, Next.js, Remix, Astro and the like.
Install the package
npm install @nkootstra/block-kitpnpm add @nkootstra/block-kityarn add @nkootstra/block-kitbun add @nkootstra/block-kitnub add @nkootstra/block-kitaube add @nkootstra/block-kitImport the stylesheet
Import the styles once, near the root of your app:
import "@nkootstra/block-kit/styles.css";The stylesheet only styles elements inside the components it ships, and rolls them back to the browser’s defaults first. Global styles in your app, such as Tailwind’s preflight, don’t change how blocks render.
Load the fonts
Slack sets text in Lato and code in Roboto Mono. Slack’s own font files aren’t redistributable, so install the open-source builds from Fontsource:
npm install @fontsource/lato @fontsource/roboto-monopnpm add @fontsource/lato @fontsource/roboto-monoyarn add @fontsource/lato @fontsource/roboto-monobun add @fontsource/lato @fontsource/roboto-mononub add @fontsource/lato @fontsource/roboto-monoaube add @fontsource/lato @fontsource/roboto-monoimport "@fontsource/lato/400.css";
import "@fontsource/lato/400-italic.css";
import "@fontsource/lato/700.css";
import "@fontsource/lato/900.css";
import "@fontsource/roboto-mono/400.css";Render a message
import { BlockKitProvider, Message } from "@nkootstra/block-kit";
export function App() {
return (
<BlockKitProvider>
<Message
blocks={[
{ type: "section", text: { type: "mrkdwn", text: "*Hello* from Block Kit :wave:" } },
]}
/>
</BlockKitProvider>
);
}Optional packages
| Package | When you need it |
|---|---|
@slack/web-api |
On your server, for the WebClient that resolves user, channel and usergroup names. Never in client code: see Keep the bot token on the server. |
Entry points
| Import | What it contains |
|---|---|
@nkootstra/block-kit |
Components, the provider, hooks and payload builders. |
@nkootstra/block-kit/styles.css |
The stylesheet. |
@nkootstra/block-kit/mrkdwn |
The mrkdwn parser, without React. See mrkdwn. |
@nkootstra/block-kit/transport |
Browser-safe. Sends interactions to your app, and resolver lookups to your server. See Connecting your app. |
@nkootstra/block-kit/server |
Server only. Signs and relays interactions, and answers resolver lookups with the bot token. |
@nkootstra/block-kit/web-api |
Resolvers backed by the Slack Web API. In the browser, give them httpResolverClient, never a WebClient. |
Give your coding agent the docs
These docs run an MCP server at https://docs.block-kit.dev/mcp. It lets an agent search the docs and read any page as Markdown. To add it to Claude Code:
claude mcp add --transport http block-kit https://docs.block-kit.dev/mcp
Other agents take the same URL as a Streamable HTTP server. Agents that don’t use MCP can read llms.txt, which lists every page’s Markdown copy.
