1.0.5 • Published 5 months ago

react-roast v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

React Roast

A React widget to get feedback

Purpose

React Roast is an open-source app inspector that allows users to select elements on a webpage, capture their state (including screenshots), and send the details to a desired channel. This tool is useful for UI/UX testing, feedback collection, and debugging user interfaces.

DemoRoastNest.com | Growati.com

Roastnest Widget Demo

Features

✅ Select any element on a webpage\ ✅ Capture element position, size, and a screenshot\ ✅ Supports React-based frameworks like Next.js\ ✅ Supports self-host and customization\ ✅ Lightweight and easy to integrate\ ✅ Written in Typescript and build using rollup

Installation

npm install react-roast

or

yarn add react-roast

Local Usage

Wrap your app with WidgetProvider provided by react-roast. The provider should be in client side and mode should be set to local and onFormSubmit should be defined.

React Example

import WidgetProvider, { FormDataProps } from "react-roast";

export default function App() {
	const handleSubmit = async ({ message, screenshot }: FormDataProps): Promise<boolean> => {
		// Must return boolean value.

		try {
			// Send message to desired channel like, Slack or discord

			return true;
		} catch (e) {
			return false;
		}
	};
	return (
		<WidgetProvider mode="local" onFormSubmit={handleSubmit}>
			<Main />
		</WidgetProvider>
	);
}

NextJS App Example

"use client";

import WidgetProvider, { FormDataProps } from "react-roast";
import { ReactNode } from "react";

export default function ReactRoastProvider({ children: ReactNode }) {
	const handleSubmit = async ({ message, screenshot }: FormDataProps): Promise<boolean> => {
		// Must return boolean value.

		try {
			// Send message to desired channel like, Slack or discord

			return true;
		} catch (e) {
			return false;
		}
	};
	return (
		<WidgetProvider mode="local" onFormSubmit={handleSubmit}>
			{children}
		</WidgetProvider>
	);
}

In app/layout.tsx

export default function RootLayout({ children }) {
	return (
		<html>
			<body>
				<ReactRoastProvider>{children}</ReactRoastProvider>
			</body>
		</html>
	);
}

Widget Props

Widget Provider Props

PropertyTypeDescription
modelocal or remoteDefines if the widget operates locally or remotely
childrenReactNodeNested components inside the provider
disablebooleanDisable the widget
onFormSubmitfunctionCallback function for form submission
customizeobjectCustomization options

Widget Customize Props

You can customize the widget by passing customize props with the following options:

PropertyTypeDescription
form.classNamestringCustom class for the form
form.messageInput.placeholderstringPlaceholder text for message input
form.submitButton.labelstringLabel for submit button
form.cancelButton.labelstringLabel for cancel button
island.directionleft or rightPosition of the floating button
island.classNamestringCustom class for the floating button
island.labelstringLabel for the floating button

Form Data Props

PropertyTypeDescription
messagestringThe message input by the user.
screenshotBlobThe captured screenshot of the selected element.

Contribution

Contributions are welcome! If you would like to improve react roast, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Make changes and commit them.
  4. Submit a pull request.

Please ensure your contributions align with the project’s coding standards and best practices. If You want help, contact here

License

MIT License.

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago