MCPcopy
hub / github.com/nilbuild/driver.js / FormHelp

Function FormHelp

docs/src/components/FormHelp.tsx:5–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import "driver.js/dist/driver.css";
4
5export function FormHelp() {
6 useEffect(() => {
7 const driverObj = driver({
8 popoverClass: "driverjs-theme",
9 stagePadding: 0,
10 onDestroyed: () => {
11 (document?.activeElement as any)?.blur();
12 }
13 });
14
15 const nameEl = document.getElementById("name");
16 const educationEl = document.getElementById("education");
17 const ageEl = document.getElementById("age");
18 const addressEl = document.getElementById("address");
19 const submitEl = document.getElementById("submit-btn");
20
21 nameEl!.addEventListener("focus", () => {
22 driverObj.highlight({
23 element: nameEl!,
24 popover: {
25 title: "Name",
26 description: "Enter your name here",
27 },
28 });
29 });
30
31 educationEl!.addEventListener("focus", () => {
32 driverObj.highlight({
33 element: educationEl!,
34 popover: {
35 title: "Education",
36 description: "Enter your education here",
37 },
38 });
39 });
40
41 ageEl!.addEventListener("focus", () => {
42 driverObj.highlight({
43 element: ageEl!,
44 popover: {
45 title: "Age",
46 description: "Enter your age here",
47 },
48 });
49 });
50
51 addressEl!.addEventListener("focus", () => {
52 driverObj.highlight({
53 element: addressEl!,
54 popover: {
55 title: "Address",
56 description: "Enter your address here",
57 },
58 });
59 });
60
61 submitEl!.addEventListener("focus", (e) => {
62 e.preventDefault();

Callers

nothing calls this directly

Calls 1

driverFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…