react-grab 0.0.49 → 0.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -130,6 +130,43 @@ if (process.env.NODE_ENV === "development") {
130
130
  }
131
131
  ```
132
132
 
133
+ ## Extending React Grab
134
+
135
+ React Grab provides an public customization API. Check out the [type definitions](https://github.com/aidenybai/react-grab/blob/main/packages/react-grab/src/types.ts) to see all available options for extending React Grab.
136
+
137
+ ```typescript
138
+ import { init } from "react-grab/core";
139
+
140
+ const api = init({
141
+ theme: {
142
+ enabled: true, // disable all UI by setting to false
143
+ hue: 180, // shift colors by 180 degrees (pink → cyan/turquoise)
144
+ crosshair: {
145
+ enabled: false, // disable crosshair
146
+ },
147
+ elementLabel: {
148
+ // when hovering over an element
149
+ backgroundColor: "#000000",
150
+ textColor: "#ffffff",
151
+ },
152
+ },
153
+
154
+ onElementSelect: (element) => {
155
+ console.log("Selected:", element);
156
+ },
157
+ onCopySuccess: (elements, content) => {
158
+ console.log("Copied to clipboard:", content);
159
+ },
160
+ onStateChange: (state) => {
161
+ console.log("Active:", state.isActive);
162
+ },
163
+ });
164
+
165
+ api.activate();
166
+ api.copyElement(document.querySelector(".my-element"));
167
+ console.log(api.getState());
168
+ ```
169
+
133
170
  ## Resources & Contributing Back
134
171
 
135
172
  Want to try it out? Check the [our demo](https://react-grab.com).