npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

retool-tiptap

v1.0.0

Published

A Tiptap Editor for use in custom Retool components

Downloads

1

Readme

Retool + BYO: React Custom Components

If you have a use case that isn't handled by Retool's built-in components, you can build your own custom component to solve that use case. Really anything that can be compiled down to javascript can be used within Retool's custom components. While Retool allows you to write React directly within its iframe code, you may find it limiting in regards to development environment or packages that can be added; this repository breaks down both barriers.

The purpose of this repository is to give a React developer a baseline development envrionment that includes

  • local development of your custom component available within your Retool app
  • an example of hot reload within the Retool sandbox'd iframe
  • add any npm package to use in the component library
  • bring your own component library example
  • examples of reading or updating data in your Retool app
  • examples of triggering queries
  • moving from development to production either inline or through a CDN

We are accepting bugs and feature requests to this repository through issues.

Getting Started

Getting started with local development happens in two parts, cloning this repository and setting up your Retool application to listen to it:

  1. Setting up local environment
    • Clone repository
    • Install dependendencies
  2. Setting up Retool application
    • Add a custom component to the application
    • Update the component's iFrame Code
    • Update the component's Model

Setting up local environment

git clone [email protected]:tryretool/custom-component-guide.git
cd custom-component-guide
yarn install
yarn dev

After starting the webpack dev server with yarn dev and the example dev server servers your built javascript at http://localhost:8080/main.js. Once the dev server is running, open up a Retool application, and drag a custom component on to the canvas.

In the component inspector, replace the default iFrame code with the following:

<script type="text/javascript" src="http://localhost:8080/index.js" />

In the component inspector, replace the Model value with the following:

{
  "greeting": "Hello, ",  
  "username": {{ current_user.fullName }},
  "message": "Welcome to custom components!",
  "yesQuery": "yesQuery",
  "noQuery": "noQuery",
  "runQuery": "runQuery"
}

Developing in this repository

You're all setup to start developing locally and having your changes appear in your Retool application; happy coding! While running yarn dev you can easily modify src/index.js and src/ExampleComponent.js.

BYO Component Library

You may wish to use your own component library in Retool for specific styling or UI elements; however, we encourage you to reach out and file a feature request! If you are bringing your own component, this repository can give you examples of how to extend your library and use it as first class components in Retool. When a custom component is available in an application, it loads into a sandbox'd iframe to give you control over an HTML document javascript. Retool will also provide you with an interface to help communicate with the Retool application; you can read more here

Retool.createReactComponent()

Retool's sandboxed iframe will provide a wrapper for React components for you to access the interface, which are available in the document at Retool.createReactComponent(). If your components are wrapped in this function, model, modelUpdate, and triggerQuery will be available for your component. For example:

// index.js
import MyComponent from './MyComponent';
const RetoolConnectedComponent = Retool.connectReactComponent(App);
ReactDOM.render(
  <RetoolConnectedComponent />, 
  document.body.appendChild(document.createElement('div')) 
);

Now within MyComponent, you have access to , model, modelUpdate, and triggerQuery through its props. For example:

// MyComponent.js
export default function MyComponent ({model, modelUpdate, triggerQuery, ...props}) {
  // ... your component
}

Alternatively, you can wrap your export with Retool.createReactComponent()

// MyComponent.js
const MyComponent = ({model, modelUpdate, triggerQuery, ...props}) => {
  // ... your component
}
export default Retool.connectReactComponent(App);
// index.js
import MyComponent from './MyComponent';
ReactDOM.render(
  <MyComponent />, 
  document.body.appendChild(document.createElement('div')) 
);

Examples

Coming Soon!

Deploying

Coming Soon!