# babel-plugin-transform-jsx-slot

> Support Slot directive for JSX.

Latest version **0.1.2** (published 2020-01-19) · 0 weekly downloads

## Install

```sh
npm install babel-plugin-transform-jsx-slot
pnpm add babel-plugin-transform-jsx-slot
yarn add babel-plugin-transform-jsx-slot
bun add babel-plugin-transform-jsx-slot
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2020-01-19 |
| First published | 2019-07-17 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jsx-plus |
| Maintainers | zeroling |
| Keywords | babel-plugin |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-transform-jsx-slot
- npm.io page: https://npm.io/package/babel-plugin-transform-jsx-slot

## Dependencies (1)

- [@babel/types](https://npm.io/package/@babel/types.md) ^7.5.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2020-01-19
- 0.1.2-0 (beta) — 2020-01-16
- 0.1.1 — 2019-07-17
- 0.1.0 — 2019-07-17

## README

# babel-plugin-transform-jsx-slot

Support Slot directive for JSX.

## Example

**Usage In**

```jsx
<WaterFall>
  <view x-slot:header>header</view>
  <view x-slot:item="props">item: {props.item}</view>
  <view x-slot:footer>footer</view>
</WaterFall>
```

**Usage Out**

```jsx 
<WaterFall
  $slots={{
    header: () => <view>header</view>,
    item: props => <view>item: {props.item}</view>,
    footer: () => <view>footer</view>
  }}
></WaterFall>
```

**Component In**

```jsx
 <view>
  <slot name="header" />

  {arr.map(item => {
    return <slot name="item" item={item} />;
  })}

  <slot name="footer" />
</view>
```

**Component Out**
```jsx
<view>
  <$slot name="header" $slots={$slots} />

  {arr.map(item => {
    return <$slot name="item" item={item} $slots={$slots} />;
  })}

  <$slot name="footer" $slots={$slots} />
</view>
```

## Installation

```sh
$ npm install babel-plugin-transform-jsx-slot
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "plugins": ["transform-jsx-slot"]
}
```

### Via CLI

```sh
$ babel --plugins transform-jsx-slot script.js
```

### Via Node API

```javascript
require("babel-core").transform("code", {
  plugins: ["transform-jsx-slot"]
});
```

---
_Source: https://npm.io/package/babel-plugin-transform-jsx-slot · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
