File tree Expand file tree Collapse file tree 4 files changed +57
-1
lines changed Expand file tree Collapse file tree 4 files changed +57
-1
lines changed Original file line number Diff line number Diff line change
1
+
2
+ import { LitElement , html , css } from 'lit' ;
3
+
4
+ /**
5
+ * FormElement
6
+ */
7
+ export class FormElement extends LitElement {
8
+ constructor ( ) {
9
+ super ( ) ;
10
+ // Default properties
11
+ this . name = 'wc-form' ;
12
+ this . method = "POST" ;
13
+ this . action = "#" ;
14
+ }
15
+ static get properties ( ) {
16
+ return {
17
+ /**
18
+ * Name of the form
19
+ * @type {String }
20
+ */
21
+ name : { type : String } ,
22
+
23
+ /**
24
+ * The method for submitting the form (POST or GET)
25
+ * @type {string }
26
+ */
27
+ method : { type : String } ,
28
+
29
+ /**
30
+ * The action when submitting the form
31
+ * @type {string }
32
+ */
33
+ action : { type : String } ,
34
+ } ;
35
+ }
36
+ render ( ) {
37
+ return html `
38
+ < form method ="${ this . method } " action ="${ this . action } "> < slot > </ slot > </ form >
39
+ ` ;
40
+ }
41
+ }
42
+
43
+ customElements . define ( 'wc-form' , FormElement ) ;
Original file line number Diff line number Diff line change @@ -98,6 +98,15 @@ <h1>Modal</h1>
98
98
</ div >
99
99
</ wc-sidemodal >
100
100
</ div >
101
+ < hr >
102
+
103
+ < div class ="container ">
104
+ < wc-form >
105
+ < h1 > Form</ h1 >
106
+ < wc-form-input name ="name " label ="Name " placeholder ="Enter your name " required > </ wc-form-input >
107
+ </ wc-form >
108
+ </ div >
109
+
101
110
</ body >
102
111
103
112
</ html >
Original file line number Diff line number Diff line change @@ -17,13 +17,17 @@ import './component/icon/IconElement';
17
17
import './component/nav/NavBarElement' ;
18
18
import './component/nav/NavItemElement' ;
19
19
20
- // Modals
20
+ // Modal Elements
21
21
import './component/modal/ModalElement' ;
22
22
import './component/modal/SideModalElement' ;
23
23
24
+ // Form Elements
25
+ import './component/form/FormElement' ;
26
+
24
27
// CSS
25
28
import './css/core.css' ;
26
29
import './css/document.css' ;
27
30
31
+ // Other
28
32
import './esbuild.js' ;
29
33
import './test.js' ;
You can’t perform that action at this time.
0 commit comments