You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

react-guify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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)

latest
npmnpm
Version
0.1.4
Version published
Weekly downloads
1
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

react-guify

npm (tag) npm bundle size NPM

React-guify is a thin wrapper around the simple GUI library guify.

image

Demo

Installation

#Yarn
yarn add guify react-guify

#NPM
npm install guify react-guify

Example

function App() {
  const [state, setState] = React.useState(initialState)
  const gui = React.useRef()
  return (
    <GuiPanel
      ref={gui}
      data={state}
      setData={setState}
      barMode="above"
      theme="light"
    >
      <GuiButton
        label="Toast"
        action={() => {
          gui.current.Toast('Current date: ' + Date.now())
        }}
      />
      <GuiText property="name" />
      <GuiTitle label="Options" />
      <GuiFile label="Select File" property="file" />
      <GuiDisplay property="name" />
      <GuiCheckbox property="checkeds" />
      <GuiColor property="color" />
      <GuiFolder label="Bounds Folder" open={true}>
        <GuiRange
          label="bounds"
          property="bounds"
          scale="log"
          onChange={value => console.log({ value })}
        />
        <GuiSelect property="movement" options={options} />
        <GuiInterval property="interval" min={5} max={70} />
      </GuiFolder>
    </GuiPanel>
  )
}

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.

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.

function ToastExample() {
  const [state, setState] = React.useState(initialState)
  const gui = React.useRef()
  return (
    <GuiPanel ref={gui} data={state} setData={setState}>
      <GuiButton
        label="Toast"
        action={() => gui.current.Toast('Hello from Toast')}
      />
    </GuiPanel>
  )
}

Todo List

  • Proper mounting and unmounting
  • Updating props on the fly

FAQs

Package last updated on 28 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts