@@ -4,7 +4,7 @@ description: HTML like form for Astro
4
4
---
5
5
6
6
## Form Input
7
- ### Input
7
+ ### BInput
8
8
9
9
The basic component for most of the form filed.
10
10
@@ -20,12 +20,16 @@ It includes the following attributes:
20
20
- ** required** - a value must be send
21
21
- ** readonly** - make the value unchangeable
22
22
- ** value** - default value, mainly use for the ` readonly ` attribute
23
+ - ** as** - change the base element (default ` input ` , can be a React component)
24
+ - ** props** - props for the ` as ` element
23
25
24
26
``` astro
25
- <Input type="date" name="meetingDate" min="2023-2-2" max"2023-4-2" required/>
27
+
28
+ ```astro
29
+ <BInput type="date" name="meetingDate" min="2023-2-2" max"2023-4-2" required/>
26
30
```
27
31
28
- ### Textarea
32
+ ### BTextarea
29
33
30
34
Simple to input, but only for text
31
35
@@ -36,37 +40,41 @@ It includes the following attributes:
36
40
- ** pattern** - regex pattern for text
37
41
- ** required** - a value must be send
38
42
- ** readonly** - make the value unchangeable
43
+ - ** as** - change the base element (default ` textarea ` , can be a React component)
44
+ - ** props** - props for the ` as ` element
39
45
40
46
``` astro
41
- <Textarea name="moreInfo" maxlength={400} required/>
47
+ <BTextarea name="moreInfo" maxlength={400} required/>
42
48
```
43
49
44
- ### Select
50
+ ### BSelect
45
51
46
52
The select component is use to make the user choose value / values
47
53
48
54
- ** type** - ` text ` / ` date ` / ` number ` - for parsing purposes
49
55
- ** multiple** - to select more then one value
50
56
- ** required** - something must be selected (default ` true ` )
57
+ - ** as** - change the base element (default ` select ` , can be a React component)
58
+ - ** props** - props for the ` as ` element
51
59
52
- #### Option
60
+ #### BOption
53
61
54
62
The select option
55
63
56
64
- ** value** - value to send to the server
57
65
- ** disabled** - you can not select this option
58
66
59
67
``` astro
60
- <Select name="favoriteFood" required={false}>
61
- <Option disabled selected>Idk</Option > <--! The default, but not selectable-->
62
- <Option >Pizaa</Option >
63
- <Option >Salad</Option >
64
- <Option >Lasagna</Option >
65
- </Select >
68
+ <BSelect name="favoriteFood" required={false}>
69
+ <BOption disabled selected>Idk</BOption > <--! The default, but not selectable-->
70
+ <BOption >Pizaa</BOption >
71
+ <BOption >Salad</BOption >
72
+ <BOption >Lasagna</BOption >
73
+ </BSelect >
66
74
```
67
75
68
76
## Form controls
69
- ` Button ` is the general form control. You can also use it without ` BindForm ` component
77
+ ` BButton ` is the general form control. You can also use it without ` BindForm ` component
70
78
Attributes:
71
79
- ** onClick** - function to execute when the button clicked
72
80
- ** connectId** - (optional) name for the button action (auto-generate by default)
@@ -78,7 +86,7 @@ function sayHi(){
78
86
console.log('Hi');
79
87
}
80
88
---
81
- <Button onClick={sayHi}>Say Hi</Button >
89
+ <BButton onClick={sayHi}>Say Hi</BButton >
82
90
83
91
```
84
92
### Note
@@ -95,7 +103,7 @@ Attributes:
95
103
96
104
``` astro
97
105
<FormErrors title="From Errors"/>
98
- <Input type='int' min="1" name='number' errorMessage="Number is smaller then 1"/>
106
+ <BInput type='int' min="1" name='number' errorMessage="Number is smaller then 1"/>
99
107
```
100
108
101
109
This will output the following:
0 commit comments