An open API service indexing awesome lists of open source software.

https://github.com/cevr/re-tailwind-rn

Rescript bindings for tailwind-rn
https://github.com/cevr/re-tailwind-rn

Last synced: 8 months ago
JSON representation

Rescript bindings for tailwind-rn

Awesome Lists containing this project

README

          

# re-tailwind-rn

Rescript bindings for [rn-tailwind](https://github.com/vadimdemedes/tailwind-rn)

## Install

```bash
npm install tailwind-rn re-tailwind-rn
```

## bsconfig.json

```
{
...
"bs-dependencies": ["reason-react-native", "reason-react", "re-tailwind-rn"]
}
```

## Usage

Use the `Tw` module

```reason
open ReactNative;

[@react.component]
let make = () =>




"Hello Tailwind"->React.string



;
```

## Usage with [custom config](https://github.com/vadimdemedes/tailwind-rn#customization)

```reason
open ReactNative;

[@module "./styles.json"] external stylesConfig: Js.Json.t = "default"

let tw = Tw.create(stylesConfig)

[@react.component]
let make = () =>




"Hello Tailwind"->React.string



;
```

### Recommended to use with [re-classnames](https://github.com/MinimaHQ/re-classnames)

```reason
open ReactNative;

type styles = {
container: Style.t,
text: Style.t,
};

let styles = {
container: Tw.make("flex justify-start rounded-md px-2 py-2 my-2"),
text: Tw.make("flex-grow text-gray-700 font-medium px-2"),
};

[@react.component]
let make = (~todo, ~completed) => {

Cn.on(completed))),
|])}>
todo->React.string

;
};
```

## API

### make

```reason
type make = string => ReactNative.Style.t;
```

### color

```reason
type color = string => string;
```

### create

```reason
type created = {
[@as "tailwind"]
make,
[@as "getColor"]
color,
};

type create = Js.Json.t => created;
```