@@ -26,30 +26,29 @@ Then, you can use the `NetlifyForm` component in place of the standard form tag.
2626 <>
2727 < Honeypot / >
2828 {success && (
29- < p sx = {{ variant : ' alerts.success ' , p : 3 }} >
29+ < p>
3030 Thanks for contacting us!
3131 < / p>
3232 )}
3333 {error && (
34- < p sx = {{ variant : ' alerts.muted ' , p : 3 }} >
34+ < p>
3535 Sorry, we could not reach servers . Because it only works on Netlify,
3636 our GitHub demo does not provide a response.
3737 < / p>
3838 )}
3939 < div>
40- < label htmlFor= ' name' sx = {{ variant : ' forms.label ' }} >
40+ < label htmlFor= ' name' >
4141 Name:
4242 < / label>
4343 < input
4444 type= ' text'
4545 name= ' name'
4646 id= ' name'
4747 onChange= {handleChange}
48- sx= {{ variant: ' forms.input' }}
4948 / >
5049 < / div>
51- < div sx = {{ pt : 2 }} >
52- < label htmlFor= ' message' sx = {{ variant : ' forms.label ' }} >
50+ < div>
51+ < label htmlFor= ' message' >
5352 Message:
5453 < / label>
5554 < textarea
@@ -58,14 +57,13 @@ Then, you can use the `NetlifyForm` component in place of the standard form tag.
5857 id= ' message'
5958 rows= ' 4'
6059 onChange= {handleChange}
61- sx= {{ variant: ' forms.textarea' }}
6260 / >
6361 < / div>
64- < div sx = {{ pt : 3 }} >
65- < button type= ' submit' sx = {{ variant : ' buttons.success ' }} >
62+ < div>
63+ < button type= ' submit' >
6664 Submit
6765 < / button>
68- < button type= ' reset' sx = {{ variant : ' buttons.danger ' }} >
66+ < button type= ' reset' >
6967 Reset
7068 < / button>
7169 < / div>
@@ -83,19 +81,17 @@ We could also use it to access `formRef` and manually reset the form as this exa
8381``` jsx live
8482< NetlifyForm name= ' Contact' action= ' /thanks' honeypotName= ' bot-field' >
8583 {({ handleChange, formRef }) => (
86- < div sx = {{ variant : ' forms.inline ' }} >
84+ < div>
8785 < input
8886 type= ' text'
8987 name= ' name'
9088 id= ' name'
9189 onChange= {handleChange}
92- sx= {{ variant: ' forms.inlineInput' }}
9390 / >
9491 {/* This button, for example, uses the context to access formRef and then
9592 ** programmatically reset this form. */ }
9693 < button
9794 type= ' button'
98- sx= {{ variant: ' buttons.danger' }}
9995 onClick= {() => formRef .current .reset ()}
10096 >
10197 Custom reset button
@@ -110,17 +106,15 @@ Same example, without destructuring, makes it clear where we access the context:
110106``` jsx live
111107< NetlifyForm name= ' Contact' action= ' /thanks' honeypotName= ' bot-field' >
112108 {(context ) => (
113- < div sx = {{ variant : ' forms.inline ' }} >
109+ < div>
114110 < input
115111 type= ' text'
116112 name= ' name'
117113 id= ' name'
118114 onChange= {context .handleChange }
119- sx= {{ variant: ' forms.inlineInput' }}
120115 / >
121116 < button
122117 type= ' button'
123- sx= {{ variant: ' buttons.danger' }}
124118 onClick= {() => context .formRef .current .reset ()}
125119 >
126120 Custom reset button
0 commit comments