MCPcopy Create free account
hub / github.com/kobaltedev/kobalte / HTMLFormExample

Function HTMLFormExample

apps/docs/src/examples/color-wheel.tsx:96–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94}
95
96export function HTMLFormExample() {
97 let formRef: HTMLFormElement | undefined;
98
99 const onSubmit = (e: SubmitEvent) => {
100 e.preventDefault();
101 e.stopPropagation();
102
103 const formData = new FormData(formRef);
104
105 alert(JSON.stringify(Object.fromEntries(formData), null, 2));
106 };
107
108 return (
109 <form
110 ref={formRef}
111 onSubmit={onSubmit}
112 class="flex flex-col items-center space-y-6"
113 >
114 <ColorWheel class={style.ColorWheelRoot} name="hue">
115 <ColorWheel.Label class={style.ColorWheelLabel}>Label</ColorWheel.Label>
116 <ColorWheel.Track class={style.ColorWheelTrack}>
117 <ColorWheel.Thumb class={style.ColorWheelThumb}>
118 <ColorWheel.Input />
119 </ColorWheel.Thumb>
120 </ColorWheel.Track>
121 </ColorWheel>
122 <div class="flex space-x-2">
123 <button type="reset" class="kb-button">
124 Reset
125 </button>
126 <button type="submit" class="kb-button-primary">
127 Submit
128 </button>
129 </div>
130 </form>
131 );
132}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected