Skip to content
/ slack-jsx Public

🎰 Compose Slack messages from JSX Components instead of writing JSON

License

Notifications You must be signed in to change notification settings

zcei/slack-jsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slack-jsx

Nested JSON is hard to grasp on first sight. Use familiar JSX component syntax to compose Slack messages instead.

js-standard-style

Install

npm install slack-jsx

Usage

/** @jsx Slack */

import Slack from 'slack-jsx'
import { Message, Attachment } from 'slack-jsx/components'

<Message text='I am a test message' />

<Message>
  <Attachment pretext='Above the attachment' />
</Message

API

pragma(node, props, ...children)

Compiles a Slack message from slack-jsx components.

  • returns: Slack JSON message string
  • node - a slack-jsx compatible component
  • props - any valid combination of Slack message props
  • children - an Array of sub-components with following behavior:
    • first child - if Array, it gets flattened into children
    • rest - not flattened in any case

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. But before doing anything, please read the CONTRIBUTING.md guidelines.

About

🎰 Compose Slack messages from JSX Components instead of writing JSON

Resources

License

Stars

Watchers

Forks

Packages

No packages published