Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/dbismut/react-guify

Thin wrapper around guify
https://github.com/dbismut/react-guify

gui guify react

Last synced: 2 months ago
JSON representation

Thin wrapper around guify

Awesome Lists containing this project

README

        

# react-guify

![npm (tag)](https://img.shields.io/npm/v/react-guify) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-guify) ![NPM](https://img.shields.io/npm/l/react-guify)

React-guify is a thin wrapper around the [simple GUI library guify](https://github.com/colejd/guify).

![image](https://raw.githubusercontent.com/colejd/guify/master/docs/Guify.png)

[Demo](https://codesandbox.io/s/react-guify-154rk)

### Installation

```bash
#Yarn
yarn add guify react-guify

#NPM
npm install guify react-guify
```

### Example

```jsx
function App() {
const [state, setState] = React.useState(initialState)
const gui = React.useRef()
return (

{
gui.current.Toast('Current date: ' + Date.now())
}}
/>







console.log({ value })}
/>




)
}
```

## Api

### Components exports

React-guify creates and exports React components that allow you to structure the GUI with React nodes.

You can pass all options from guify as props to these components. For now components will not respond to props update.

[Read guify docs for more](https://github.com/colejd/guify/).

#### Main panel

- `GuiPanel`: guify main panel.

In addition to the native options from guify, the panel requires two additional props:

- `data`: the data object bound to components.
- `setData`: the function the panel will call to update your data when values change.

#### Data-bound components

- `GuiCheckbox`: a checkbox
- `GuiRange`: a number selector
- `GuiInterval`: an interval selector
- `GuiColor`: a color selector
- `GuiSelect`: an option selector
- `GuiText`: a free-text entry
- `GuiDisplay`: displays a variable
- `GuiFile`: a file selector

#### Action components

- `GuiButton`: a button with an action

#### Organizational components:

- `GuiTitle`: shows a title
- `GuiFolder`: a folder grouping different components

### Toast

guify has a nice toast feature that React-guify tries to implement seamlessly. The panel component will pass back a ref to you, which will include the original `gui` object created by guify.

```jsx
function ToastExample() {
const [state, setState] = React.useState(initialState)
const gui = React.useRef()
return (

gui.current.Toast('Hello from Toast')}
/>

)
}
```

---

### Todo List

- [ ] Proper mounting and unmounting
- [ ] Updating props on the fly