react-kotlin-playground
Version:
React wrapper for kotlin playground
83 lines (64 loc) • 2.95 kB
Markdown
# React Kotlin Playground
[![npm][npm]][npm-url]
[](https://david-dm.org/zoobestik/react-kotlin-playground)
[](https://david-dm.org/zoobestik/react-kotlin-playground)
[](http://npm-stats.com/~packages/react-kotlin-playground)
React wrapper for [kotlin-playground](https://github.com/JetBrains/kotlin-playground#options) widget.
## Install
```bash
npm i --save react-kotlin-playground kotlin-playground
```
## Usage
```jsx
import React from "react";
import ReactDOM from "react-dom";
import KotlinPlayground from "react-kotlin-playground";
// For modern bundle:
// import KotlinPlayground from 'react-kotlin-playground/es';
ReactDOM.render(
<KotlinPlayground mode="kotlin">
fun main(args: Array<String>){" "}
{
//sampleStart
println("Hello World")
//sampleEnd
}
</KotlinPlayground>,
container
);
```
## API
| Name | Type | Default | Description |
| ------------- | ------ | ------- | ------------------------------- |
| **className** | string | null | Add classes for codewrapper |
| **children** | node | | **Initial** source code for run |
Plus all [options](https://github.com/JetBrains/kotlin-playground#customizing-editors) and [events](https://github.com/JetBrains/kotlin-playground#options) from original library:
in react props style - without `data-` prefix and in camelCase, like
```jsx
<KotlinPlayground
autoIndent={2}
targetPlatform="js"
{/* ...and any other */ }
>...</KotlinPlayground>
```
**or** in html attrs style - like in original library:
```jsx
<KotlinPlayground
auto-indent={2}
data-target-platform="js"
{/* ...and any other */ }
>...</KotlinPlayground>
```
[More props](es/index.js#L98) options
## Acknowledgements
[](https://ru.linkedin.com/in/kbchernenko) [](http://opensource.org/licenses/MIT)
[npm]: https://img.shields.io/npm/v/react-kotlin-playground.svg
[npm-url]: https://npmjs.com/package/react-kotlin-playground
[node]: https://img.shields.io/node/v/react-kotlin-playground.svg
[node-url]: https://nodejs.org
[deps]: https://david-dm.org/zoobestik/react-kotlin-playground.svg
[deps-url]: https://david-dm.org/zoobestik/react-kotlin-playground
[tests]: http://img.shields.io/travis/zoobestik/react-kotlin-playground.svg
[tests-url]: https://travis-ci.org/zoobestik/react-kotlin-playground
[cover]: https://coveralls.io/repos/github/zoobestik/react-kotlin-playground/badge.svg
[cover-url]: https://coveralls.io/github/zoobestik/react-kotlin-playground