Add the turbo-mount gem to your Gemfile:

gem 'turbo-mount'

If your project uses build tools like Vite, also install the turbo-mount npm package:

yarn add turbo-mount

Import the necessary modules and initialize TurboMount with your application and the desired plugin:

import { Application } from "@hotwired/stimulus";
import { TurboMount } from "turbo-mount";
import plugin from "turbo-mount/react";
import { SketchPicker } from 'react-color';

const application = Application.start();
const turboMount = new TurboMount({ application, plugin });
turboMount.register('SketchPicker', SketchPicker);

And finally, add the component to your view:

<%= turbo_mount_react_component("SketchPicker", props: {color: "#430"}) %>

In the same orbit

Explore more open source projects

How can we help you?

Martians at a glance
years in business

We transform growth-stage startups into unicorns, build developer tools, and create open source products.

If you prefer email, write to us at surrender@evilmartians.com