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>
9898 </ div >
9999 </ wc-sidemodal >
100100 </ 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+
101110</ body >
102111
103112</ html >
Original file line number Diff line number Diff line change @@ -17,13 +17,17 @@ import './component/icon/IconElement';
1717import './component/nav/NavBarElement' ;
1818import './component/nav/NavItemElement' ;
1919
20- // Modals
20+ // Modal Elements
2121import './component/modal/ModalElement' ;
2222import './component/modal/SideModalElement' ;
2323
24+ // Form Elements
25+ import './component/form/FormElement' ;
26+
2427// CSS
2528import './css/core.css' ;
2629import './css/document.css' ;
2730
31+ // Other
2832import './esbuild.js' ;
2933import './test.js' ;
You can’t perform that action at this time.
0 commit comments