clipxjs 1.2.0 → 1.2.2

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
@@ -1,293 +1,410 @@
1
- ![License](https://img.shields.io/badge/License-MIT-ff932e)
2
- ![Release](https://img.shields.io/github/v/release/mraxays/clipxjs?color=ff7a5e)
3
-
4
- # ClipX.js -Maximize Clipboard Power with Minimal Size
5
-
6
-
7
- ClipX.js is an ultra-light JavaScript library that simplifies clipboard tasks and enriches user feedback. It offers straightforward `copy, cut, and paste` capabilities, and `built-in toast notifications` that you can easily customize, providing a quick and efficient way to handle clipboard and notification needs. ——— The Smarter Clipboard Solution.
8
-
9
- ---
10
- ## Official Website
11
-
12
- For more information about this project, please visit our official website: [ClipX](https://clipx.dzr.app/)
13
-
14
- ---
15
- ## Table of Contents 📑
16
-
17
- 1. [Why Choose ClipX.js?](#why-choose-clipxjs)
18
- - [Lightweight & Fast](#lightweight--fast)
19
- - [Built-in Feedback](#built-in-feedback)
20
- - [Flexible Customization](#flexible-customization)
21
- - [Easy Integration](#easy-integration)
22
- - [Robust Error Handling](#robust-error-handling)
23
- 2. [Installation](#installation)
24
- - [Via NPM](#via-npm)
25
- - [Via CDN](#via-cdn)
26
- 3. [Initializing ClipX.js](#initializing-clipxjs)
27
- - [Basic Initialization](#basic-initialization)
28
- - [Configuration Options](#configuration-options)
29
- 4. [Attaching ClipX Functionality](#attaching-clipx-functionality)
30
- - [Example: Using Data Attributes](#example-using-data-attributes)
31
- - [Example: Using Class Names](#example-using-class-names)
32
- 5. [Attributes Overview](#attributes-overview)
33
- - [`data-clipx-target`](#data-clipx-target)
34
- - [`data-clipx-text`](#data-clipx-text)
35
- - [`data-clipx-cut`](#data-clipx-cut)
36
- - [`data-clipx-msg`](#data-clipx-msg)
37
- - [`data-clipx-toast`](#data-clipx-toast)
38
- - [`data-clipx-disable-msg`](#data-clipx-disable-msg)
39
- - [`data-clipx-disable-toast`](#data-clipx-disable-toast)
40
- - [`data-clipx-toast-position`](#data-clipx-toast-position)
41
- - [`data-clipx-duration`](#data-clipx-duration)
42
- 6. [Example](#example)
43
- 7. [Demo](#demo--get-start-code)
44
-
45
- ---
46
- ## Why Choose ClipX.js?
47
-
48
- ### Lightweight & Fast
49
- - At only 2KB, ClipX.js is smaller and faster than most clipboard libraries.
50
- ### Built-in Feedback
51
- - Includes customizable toast notifications for clipboard actions—no need for additional UI libraries.
52
- ### Flexible Customization
53
- - Easily style toasts, control message display, and integrate seamlessly with your app's design.
54
- ### Easy Integration
55
- - Simple API with minimal setup, ensuring broad compatibility across modern and older browsers.
56
- ### Robust Error Handling
57
- - Provides clear, customizable error feedback to enhance user experience and simplify debugging.
58
-
59
- ---
60
-
61
- ## Installation
62
-
63
- ### Via NPM
64
-
65
- ```bash
66
- npm i clipxjs
67
- ```
68
- ### Via CDN
69
-
70
- Use only one `CDN`
71
-
72
- **jsdelivr**
73
-
74
- ```html
75
- <script src="https://cdn.jsdelivr.net/npm/clipxjs/dist/clipx.min.js"></script>
76
- ```
77
-
78
- **OR**
79
-
80
- **unpkg**
81
-
82
- ```html
83
- <script src="https://unpkg.com/clipxjs/dist/clipx.min.js"></script>
84
- ```
85
- ---
86
- ## Initializing ClipX.js
87
-
88
- To get started with ClipX.js, follow these steps to set up and configure the library according to your needs:
89
-
90
- ## Basic Initialization
91
-
92
- ```javascript
93
- /* Initialize ClipX.js instance */
94
- var clipx = new clipx();
95
- ```
96
-
97
- ## Configuration Options
98
-
99
- ### 1. Disable Text Content Change Globally
100
-
101
- To prevent the text content of elements from changing globally, set the `msg` property to `true`. Otherwise, set it to `false` to enable text content change.
102
-
103
- ```javascript
104
- clipx.disable.msg = false; // Set to true to disable text content change globally
105
- ```
106
-
107
- ### 2. Disable Toast Notifications Globally
108
-
109
- To prevent toast notifications from showing globally, set the `toast` property to `true`. Otherwise, set it to `false` to enable toast notifications.
110
-
111
- ```javascript
112
- clipx.disable.toast = false; // Set to true to disable toast notifications globally
113
- ```
114
-
115
- ### 3. Set Custom Styles for Toast Notifications
116
-
117
- Customize the appearance of toast notifications by providing CSS styles. For example, the following configuration sets a dark background with white text, padding, and rounded corners.
118
-
119
- ```javascript
120
- clipx.setCustomStyles({
121
- toast: "background-color: #333; color: #fff; padding: 12px; border-radius: 5px;"
122
- });
123
- ```
124
-
125
- ## Attaching ClipX Functionality
126
-
127
- To bind ClipX.js functionality to elements, use the `attach` method with appropriate selectors. This method will enable clipboard operations on elements with the specified attributes or classes.
128
-
129
- ### Example: Using Data Attributes
130
-
131
- Apply ClipX.js to elements with `data-clipx-text` or `data-clipx-target` attributes.
132
-
133
- ```javascript
134
- clipx.attach('[data-clipx-text], [data-clipx-target]');
135
- ```
136
-
137
- ### Example: Using Class Names
138
-
139
- Alternatively, apply ClipX.js to elements with specific classes.
140
-
141
- ```javascript
142
- clipx.attach('.clipx, .copy-btn, .your-class');
143
- ```
144
-
145
-
146
- ---
147
- ## Attributes Overview
148
-
149
- ### This All Are Attributes
150
- - **`data-clipx-target`**: Element selector for text source.
151
- - **`data-clipx-text`**: Static text to copy or cut.
152
- - **`data-clipx-cut`**: Toggle cut operation.
153
- - **`data-clipx-msg`**: Custom success message.
154
- - **`data-clipx-toast`**: Show only toast, no text change.
155
- - **`data-clipx-disable-msg`**: Disable element text change.
156
- - **`data-clipx-disable-toast`**: Disable toast notification.
157
- - **`data-clipx-toast-position`**: Position of the toast (top/bottom).
158
- - **`data-clipx-duration`**: Duration of toast visibility.
159
-
160
- ---
161
-
162
-
163
- ## Example
164
-
165
- ### `data-clipx-target`
166
-
167
- **Description:** Specifies the target element whose text will be copied to the clipboard when the button is clicked.
168
-
169
- **Example:**
170
- ```html
171
- <button class="copy-btn" data-clipx-target="#text-to-copy">Copy Text</button>
172
- <p id="text-to-copy">This is the text to be copied.</p>
173
- ```
174
-
175
- ### `data-clipx-text`
176
-
177
- **Description:** Defines a static text string that will be copied to the clipboard when the button is clicked.
178
-
179
- **Example:**
180
- ```html
181
- <button class="copy-btn" data-clipx-text="Static text to copy">Copy Static Text</button>
182
- ```
183
-
184
- ### `data-clipx-cut`
185
-
186
- **Description:** Cuts the text from the specified element, copying it to the clipboard and clearing the element's content.
187
-
188
- **Example:**
189
- ```html
190
- <textarea id="text-to-cut">This text will be cut.</textarea>
191
- <button class="copy-btn" data-clipx-target="#text-to-cut" data-clipx-cut>Cut Text</button>
192
- ```
193
-
194
- ### `data-clipx-msg`
195
-
196
- **Description:** Copies the specified text to the clipboard and shows a toast notification with a custom message.
197
-
198
- **Example:**
199
- ```html
200
- <button class="copy-btn" data-clipx-text="Another static text" data-clipx-msg="Text copied successfully!">Copy with Custom Message</button>
201
- ```
202
-
203
- ### `data-clipx-toast`
204
-
205
- **Description:** Displays a toast notification with the copied text. The button text remains unchanged.
206
-
207
- **Example:**
208
- ```html
209
- <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-toast>Copy with Toast Only</button>
210
- ```
211
-
212
- ### `data-clipx-disable-msg`
213
-
214
- **Description:** Shows a toast notification without changing the button's text content.
215
-
216
- **Example:**
217
- ```html
218
- <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-disable-msg>Copy with Toast Only, No Text Change</button>
219
- ```
220
-
221
- ### `USE data-clipx-disable-toast & data-clipx-disable-msg`
222
-
223
- **Description:** Copies the specified text to the clipboard without showing a toast notification And Changing Text Contents.
224
-
225
- **Example:**
226
- ```html
227
- <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-disable-toast data-clipx-disable-msg>Copy without Toast & with Change Text</button>
228
- ```
229
-
230
- ### `data-clipx-disable-toast`
231
-
232
- **Description:** Copies the specified text to the clipboard without showing a toast notification.
233
-
234
- **Example:**
235
- ```html
236
- <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-disable-toast>Copy without Toast</button>
237
- ```
238
-
239
- ### `data-clipx-toast-position`
240
-
241
- **Description:** Defines the position of the toast notification (top or bottom).
242
-
243
- **Example:**
244
- ```html
245
- <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-toast data-clipx-toast-position="top">Copy with Toast on Top</button>
246
- <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-toast data-clipx-toast-position="bottom">Copy with Toast on Bottom</button>
247
- ```
248
-
249
- ### `data-clipx-duration`
250
-
251
- **Description:** Sets the duration (in milliseconds) for which the toast notification is visible before it fades out.
252
-
253
- **Example:**
254
- ```html
255
- <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-toast data-clipx-duration="3000">Copy with 3 Seconds Toast</button>
256
- <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-duration="3000">Copy with 3 Seconds Toast & Content Change</button>
257
- <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-disable-toast data-clipx-duration="3000">Copy 3 sec Content Change</button>
258
- ```
259
- ---
260
-
261
- ## Demo || Get Start Code
262
-
263
- ```html
264
-
265
- <h1>ClipX.js Demo</h1>
266
-
267
- <button class="copy-btn" data-clipx-text="Static text to copy" data-clipx-msg="Static text copied!">Copy Static Text</button>
268
-
269
- <button class="copy-btn" data-clipx-target="#text-to-copy" data-clipx-cut>Cut Text</button>
270
- <button class="copy-btn" data-clipx-target="#text-to-copy">Copy Text</button>
271
-
272
- <p id="text-to-copy">This text will be cut and copied to the clipboard.</p>
273
-
274
- <button class="copy-btn" data-clipx-text="Another static text" data-clipx-toast data-clipx-toast-position="bottom">Copy with Toast Only</button>
275
-
276
- <button class="copy-btn" data-clipx-text="Text with 5 seconds toast" data-clipx-toast data-clipx-duration="5000">Copy with 5 Seconds Toast</button>
277
-
278
-
279
- <script src="https://cdn.jsdelivr.net/npm/clipxjs/dist/clipx.min.js"></script>
280
- <script>
281
- // Initialize ClipX.js instance
282
- var clipx = new clipx();
283
-
284
- // Optional: Set custom styles for toast notifications
285
- clipx.setCustomStyles({
286
- toast: "background-color: #333; color: #fff; padding: 12px; border-radius: 5px;"
287
- });
288
-
289
- // Attach ClipX.js functionality to elements
290
- clipx.attach('[data-clipx-text], [data-clipx-target]');
291
- </script>
292
-
293
- ```
1
+ ![License](https://img.shields.io/badge/License-MIT-ff932e)
2
+ ![Release](https://img.shields.io/github/v/release/mraxays/clipxjs?color=ff7a5e)
3
+
4
+ # ClipX.js -Maximize Clipboard Power with Minimal Size
5
+
6
+ ClipX.js is an ultra-light JavaScript library that simplifies clipboard tasks and enriches user feedback. It offers straightforward `copy, cut, and paste` capabilities, and `built-in toast notifications` that you can easily customize, providing a quick and efficient way to handle clipboard and notification needs. ——— The Smarter Clipboard Solution.
7
+
8
+ ---
9
+
10
+ ## Official Website
11
+
12
+ For more information about this project, please visit our official website: [ClipX](https://clipx.js.org/)
13
+
14
+ ---
15
+
16
+ ## Table of Contents 📑
17
+
18
+ 1. [Why Choose ClipX.js?](#why-choose-clipxjs)
19
+ - [Lightweight & Fast](#lightweight--fast)
20
+ - [Built-in Feedback](#built-in-feedback)
21
+ - [Flexible Customization](#flexible-customization)
22
+ - [Easy Integration](#easy-integration)
23
+ - [Robust Error Handling](#robust-error-handling)
24
+ 2. [Installation](#installation)
25
+ - [Via NPM](#via-npm)
26
+ - [Via CDN](#via-cdn)
27
+ 3. [Initializing ClipX.js](#initializing-clipxjs)
28
+ - [Basic Initialization](#basic-initialization)
29
+ - [Configuration Options](#configuration-options)
30
+ 4. [Attaching ClipX Functionality](#attaching-clipx-functionality)
31
+ - [Example: Using Data Attributes](#example-using-data-attributes)
32
+ - [Example: Using Class Names](#example-using-class-names)
33
+ 5. [Attributes Overview](#attributes-overview)
34
+ - [`data-clipx-target`](#data-clipx-target)
35
+ - [`data-clipx-text`](#data-clipx-text)
36
+ - [`data-clipx-cut`](#data-clipx-cut)
37
+ - [`data-clipx-msg`](#data-clipx-msg)
38
+ - [`data-clipx-toast`](#data-clipx-toast)
39
+ - [`data-clipx-disable-msg`](#data-clipx-disable-msg)
40
+ - [`data-clipx-disable-toast`](#data-clipx-disable-toast)
41
+ - [`data-clipx-toast-position`](#data-clipx-toast-position)
42
+ - [`data-clipx-duration`](#data-clipx-duration)
43
+ 6. [Example](#example)
44
+ 7. [Demo](#demo--get-start-code)
45
+
46
+ ---
47
+
48
+ ## Why Choose ClipX.js?
49
+
50
+ ### Lightweight & Fast
51
+
52
+ - At only 2KB, ClipX.js is smaller and faster than most clipboard libraries.
53
+
54
+ ### Built-in Feedback
55
+
56
+ - Includes customizable toast notifications for clipboard actions—no need for additional UI libraries.
57
+
58
+ ### Flexible Customization
59
+
60
+ - Easily style toasts, control message display, and integrate seamlessly with your app's design.
61
+
62
+ ### Easy Integration
63
+
64
+ - Simple API with minimal setup, ensuring broad compatibility across modern and older browsers.
65
+
66
+ ### Robust Error Handling
67
+
68
+ - Provides clear, customizable error feedback to enhance user experience and simplify debugging.
69
+
70
+ ---
71
+
72
+ ## Installation
73
+
74
+ ### Via NPM
75
+
76
+ ```bash
77
+ npm i clipxjs
78
+ ```
79
+
80
+ ### Via CDN
81
+
82
+ Use only one `CDN`
83
+
84
+ **jsdelivr**
85
+
86
+ ```html
87
+ <script src="https://cdn.jsdelivr.net/npm/clipxjs/dist/clipx.min.js"></script>
88
+ ```
89
+
90
+ **OR**
91
+
92
+ **unpkg**
93
+
94
+ ```html
95
+ <script src="https://unpkg.com/clipxjs/dist/clipx.min.js"></script>
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Initializing ClipX.js
101
+
102
+ To get started with ClipX.js, follow these steps to set up and configure the library according to your needs:
103
+
104
+ ## Basic Initialization
105
+
106
+ ```javascript
107
+ /* Initialize ClipX.js instance */
108
+ var clipx = new clipx();
109
+ ```
110
+
111
+ ## Configuration Options
112
+
113
+ ### 1. Disable Text Content Change Globally
114
+
115
+ To prevent the text content of elements from changing globally, set the `msg` property to `true`. Otherwise, set it to `false` to enable text content change.
116
+
117
+ ```javascript
118
+ clipx.disable.msg = false; // Set to true to disable text content change globally
119
+ ```
120
+
121
+ ### 2. Disable Toast Notifications Globally
122
+
123
+ To prevent toast notifications from showing globally, set the `toast` property to `true`. Otherwise, set it to `false` to enable toast notifications.
124
+
125
+ ```javascript
126
+ clipx.disable.toast = false; // Set to true to disable toast notifications globally
127
+ ```
128
+
129
+ ### 3. Set Custom Styles for Toast Notifications
130
+
131
+ Customize the appearance of toast notifications by providing CSS styles. For example, the following configuration sets a dark background with white text, padding, and rounded corners.
132
+
133
+ ```javascript
134
+ clipx.setCustomStyles({
135
+ toast:
136
+ "background-color: #333; color: #fff; padding: 12px; border-radius: 5px;",
137
+ });
138
+ ```
139
+
140
+ ### 4. Hide SVG Icon
141
+
142
+ To hide Svg Icon from toast
143
+
144
+ ```css
145
+ .clipx-js-svg-icon {
146
+ display: none;
147
+ }
148
+ ```
149
+
150
+ ## Attaching ClipX Functionality
151
+
152
+ To bind ClipX.js functionality to elements, use the `attach` method with appropriate selectors. This method will enable clipboard operations on elements with the specified attributes or classes.
153
+
154
+ ### Example: Using Data Attributes
155
+
156
+ Apply ClipX.js to elements with `data-clipx-text` or `data-clipx-target` attributes.
157
+
158
+ ```javascript
159
+ clipx.attach("[data-clipx-text], [data-clipx-target]");
160
+ ```
161
+
162
+ ### Example: Using Class Names
163
+
164
+ Alternatively, apply ClipX.js to elements with specific classes.
165
+
166
+ ```javascript
167
+ clipx.attach(".clipx, .copy-btn, .your-class");
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Attributes Overview
173
+
174
+ ### This All Are Attributes
175
+
176
+ - **`data-clipx-target`**: Element selector for text source.
177
+ - **`data-clipx-text`**: Static text to copy or cut.
178
+ - **`data-clipx-cut`**: Toggle cut operation.
179
+ - **`data-clipx-msg`**: Custom success message.
180
+ - **`data-clipx-toast`**: Show only toast, no text change.
181
+ - **`data-clipx-disable-msg`**: Disable element text change.
182
+ - **`data-clipx-disable-toast`**: Disable toast notification.
183
+ - **`data-clipx-toast-position`**: Position of the toast (top/bottom).
184
+ - **`data-clipx-duration`**: Duration of toast visibility.
185
+
186
+ ---
187
+
188
+ ## Example
189
+
190
+ ### `data-clipx-target`
191
+
192
+ **Description:** Specifies the target element whose text will be copied to the clipboard when the button is clicked.
193
+
194
+ **Example:**
195
+
196
+ ```html
197
+ <button class="copy-btn" data-clipx-target="#text-to-copy">Copy Text</button>
198
+ <p id="text-to-copy">This is the text to be copied.</p>
199
+ ```
200
+
201
+ ### `data-clipx-text`
202
+
203
+ **Description:** Defines a static text string that will be copied to the clipboard when the button is clicked.
204
+
205
+ **Example:**
206
+
207
+ ```html
208
+ <button class="copy-btn" data-clipx-text="Static text to copy">
209
+ Copy Static Text
210
+ </button>
211
+ ```
212
+
213
+ ### `data-clipx-cut`
214
+
215
+ **Description:** Cuts the text from the specified element, copying it to the clipboard and clearing the element's content.
216
+
217
+ **Example:**
218
+
219
+ ```html
220
+ <textarea id="text-to-cut">This text will be cut.</textarea>
221
+ <button class="copy-btn" data-clipx-target="#text-to-cut" data-clipx-cut>
222
+ Cut Text
223
+ </button>
224
+ ```
225
+
226
+ ### `data-clipx-msg`
227
+
228
+ **Description:** Copies the specified text to the clipboard and shows a toast notification with a custom message.
229
+
230
+ **Example:**
231
+
232
+ ```html
233
+ <button
234
+ class="copy-btn"
235
+ data-clipx-text="Another static text"
236
+ data-clipx-msg="Text copied successfully!"
237
+ >
238
+ Copy with Custom Message
239
+ </button>
240
+ ```
241
+
242
+ ### `data-clipx-toast`
243
+
244
+ **Description:** Displays a toast notification with the copied text. The button text remains unchanged.
245
+
246
+ **Example:**
247
+
248
+ ```html
249
+ <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-toast>
250
+ Copy with Toast Only
251
+ </button>
252
+ ```
253
+
254
+ ### `data-clipx-disable-msg`
255
+
256
+ **Description:** Shows a toast notification without changing the button's text content.
257
+
258
+ **Example:**
259
+
260
+ ```html
261
+ <button class="copy-btn" data-clipx-text="Text to copy" data-clipx-disable-msg>
262
+ Copy with Toast Only, No Text Change
263
+ </button>
264
+ ```
265
+
266
+ ### `USE data-clipx-disable-toast & data-clipx-disable-msg`
267
+
268
+ **Description:** Copies the specified text to the clipboard without showing a toast notification And Changing Text Contents.
269
+
270
+ **Example:**
271
+
272
+ ```html
273
+ <button
274
+ class="copy-btn"
275
+ data-clipx-text="Text to copy"
276
+ data-clipx-disable-toast
277
+ data-clipx-disable-msg
278
+ >
279
+ Copy without Toast & with Change Text
280
+ </button>
281
+ ```
282
+
283
+ ### `data-clipx-disable-toast`
284
+
285
+ **Description:** Copies the specified text to the clipboard without showing a toast notification.
286
+
287
+ **Example:**
288
+
289
+ ```html
290
+ <button
291
+ class="copy-btn"
292
+ data-clipx-text="Text to copy"
293
+ data-clipx-disable-toast
294
+ >
295
+ Copy without Toast
296
+ </button>
297
+ ```
298
+
299
+ ### `data-clipx-toast-position`
300
+
301
+ **Description:** Defines the position of the toast notification (top or bottom).
302
+
303
+ **Example:**
304
+
305
+ ```html
306
+ <button
307
+ class="copy-btn"
308
+ data-clipx-text="Text to copy"
309
+ data-clipx-toast
310
+ data-clipx-toast-position="top"
311
+ >
312
+ Copy with Toast on Top
313
+ </button>
314
+ <button
315
+ class="copy-btn"
316
+ data-clipx-text="Text to copy"
317
+ data-clipx-toast
318
+ data-clipx-toast-position="bottom"
319
+ >
320
+ Copy with Toast on Bottom
321
+ </button>
322
+ ```
323
+
324
+ ### `data-clipx-duration`
325
+
326
+ **Description:** Sets the duration (in milliseconds) for which the toast notification is visible before it fades out.
327
+
328
+ **Example:**
329
+
330
+ ```html
331
+ <button
332
+ class="copy-btn"
333
+ data-clipx-text="Text to copy"
334
+ data-clipx-toast
335
+ data-clipx-duration="3000"
336
+ >
337
+ Copy with 3 Seconds Toast
338
+ </button>
339
+ <button
340
+ class="copy-btn"
341
+ data-clipx-text="Text to copy"
342
+ data-clipx-duration="3000"
343
+ >
344
+ Copy with 3 Seconds Toast & Content Change
345
+ </button>
346
+ <button
347
+ class="copy-btn"
348
+ data-clipx-text="Text to copy"
349
+ data-clipx-disable-toast
350
+ data-clipx-duration="3000"
351
+ >
352
+ Copy 3 sec Content Change
353
+ </button>
354
+ ```
355
+
356
+ ---
357
+
358
+ ## Demo || Get Start Code
359
+
360
+ ```html
361
+ <h1>ClipX.js Demo</h1>
362
+
363
+ <button
364
+ class="copy-btn"
365
+ data-clipx-text="Static text to copy"
366
+ data-clipx-msg="Static text copied!"
367
+ >
368
+ Copy Static Text
369
+ </button>
370
+
371
+ <button class="copy-btn" data-clipx-target="#text-to-copy" data-clipx-cut>
372
+ Cut Text
373
+ </button>
374
+ <button class="copy-btn" data-clipx-target="#text-to-copy">Copy Text</button>
375
+
376
+ <p id="text-to-copy">This text will be cut and copied to the clipboard.</p>
377
+
378
+ <button
379
+ class="copy-btn"
380
+ data-clipx-text="Another static text"
381
+ data-clipx-toast
382
+ data-clipx-toast-position="bottom"
383
+ >
384
+ Copy with Toast Only
385
+ </button>
386
+
387
+ <button
388
+ class="copy-btn"
389
+ data-clipx-text="Text with 5 seconds toast"
390
+ data-clipx-toast
391
+ data-clipx-duration="5000"
392
+ >
393
+ Copy with 5 Seconds Toast
394
+ </button>
395
+
396
+ <script src="https://cdn.jsdelivr.net/npm/clipxjs/dist/clipx.min.js"></script>
397
+ <script>
398
+ // Initialize ClipX.js instance
399
+ var clipx = new clipx();
400
+
401
+ // Optional: Set custom styles for toast notifications
402
+ clipx.setCustomStyles({
403
+ toast:
404
+ "background-color: #333; color: #fff; padding: 12px; border-radius: 5px;",
405
+ });
406
+
407
+ // Attach ClipX.js functionality to elements
408
+ clipx.attach("[data-clipx-text], [data-clipx-target]");
409
+ </script>
410
+ ```