kevin940726 / slack-blockx

jsx for Slack block-kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

slack-blockx

jsx for Slack block-kit

Installation

yarn add slack-blockx

Usage

/** @jsx createBlock */
import { createBlock } from 'slack-blockx';

console.log(
  <blocks>
    <actions>
      <button>Button</button>
    </actions>
  </blocks>
);
// Logs:
// {
//   "blocks": [
//     {
//       "type": "actions",
//       "elements": [
//         {
//           "type": "button",
//           "text": {
//             "type": "plain_text",
//             "emoji": true,
//             "text": "Button"
//           }
//         }
//       ]
//     }
//   ]
// }

View it on Block Kit Builder

Usage without compiler

const { jsx } = require('slack-blockx');

console.log(jsx`
  <blocks>
    <actions>
      <button>Button</button>
    </actions>
  </blocks>
`); // Same as above

View it on Block Kit Builder

Documentation

WIP

About

jsx for Slack block-kit

License:MIT License


Languages

Language:TypeScript 99.5%Language:HTML 0.4%Language:JavaScript 0.1%