HTML
xxxxxxxxxx
1
<div class="container my-4">
2
<p>
3
<strong>You can easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs.
4
See the examples.</strong>
5
</p>
6
7
<p>
8
Detailed documentation and more examples you can find in our
9
<a href="https://mdbootstrap.com/docs/standard/forms/input-fields/" target="_blank"><strong>Bootstrap
10
Input fields Docs</strong></a>
11
</p>
12
13
14
<hr />
15
16
<p class="font-weight-bold">Basic example</p>
17
18
<p>
19
Place one add-on or button on either side of an input. You may also place one on both sides of
20
an input. Remember to place <code><label></code>s outside the input group.
21
</p>
22
23
<div class="border p-5">
24
<!-- Copy this code to have a working example -->
25
<div class="d-flex justify-content-center">
26
<div>
27
<div class="input-group mb-3">
28
<span class="input-group-text" id="basic-addon1">@</span>
29
<input
30
type="text"
31
class="form-control"
32
placeholder="Username"
33
aria-label="Username"
34
aria-describedby="basic-addon1"
35
/>
36
</div>
37
38
<div class="input-group mb-3">
39
<input
40
type="text"
41
class="form-control"
42
placeholder="Recipient's username"
43
aria-label="Recipient's username"
44
aria-describedby="basic-addon2"
45
/>
46
<span class="input-group-text" id="basic-addon2">@example.com</span>
47
</div>
48
49
<label for="basic-url" class="form-label">Your vanity URL</label>
50
<div class="input-group mb-3">
51
<span class="input-group-text" id="basic-addon3">https://example.com/users/</span>
52
<input
53
type="text"
54
class="form-control"
55
id="basic-url"
56
aria-describedby="basic-addon3"
57
/>
58
</div>
59
60
<div class="input-group mb-3">
61
<span class="input-group-text">$</span>
62
<input type="text" class="form-control" aria-label="Amount (to the nearest dollar)" />
63
<span class="input-group-text">.00</span>
64
</div>
65
66
<div class="input-group mb-3">
67
<input type="text" class="form-control" placeholder="Username" aria-label="Username" />
68
<span class="input-group-text">@</span>
69
<input type="text" class="form-control" placeholder="Server" aria-label="Server" />
70
</div>
71
72
<div class="input-group">
73
<span class="input-group-text">With textarea</span>
74
<textarea class="form-control" aria-label="With textarea"></textarea>
75
</div>
76
77
</div>
78
</div>
79
<!--/ Copy this code to have a working example -->
80
</div>
81
82
<p class="font-weight-bold mt-3">No border</p>
83
84
<p>
85
Add <code>.border-0</code> class to the <code>.input-group-text</code> to remove the border.
86
</p>
87
88
<div class="border p-5">
89
<!-- Copy this code to have a working example -->
90
<div class="d-flex justify-content-center">
91
<div>
92
<div class="input-group mb-3">
93
<span class="input-group-text border-0" id="search-addon"
94
><i class="fas fa-search"></i
95
></span>
96
<input
97
type="search"
98
class="form-control rounded"
99
placeholder="Search"
100
aria-label="Search"
101
aria-describedby="search-addon"
102
/>
103
</div>
104
105
<div class="input-group mb-3">
106
<span class="input-group-text border-0" id="basic-addon1">@</span>
107
<input
108
type="text"
109
class="form-control rounded"
110
placeholder="Username"
111
aria-label="Username"
112
aria-describedby="basic-addon1"
113
/>
114
</div>
115
116
<div class="input-group mb-3">
117
<input
118
type="text"
119
class="form-control rounded"
120
placeholder="Recipient's username"
121
aria-label="Recipient's username"
122
aria-describedby="basic-addon2"
123
/>
124
<span class="input-group-text border-0" id="basic-addon2">@example.com</span>
125
</div>
126
127
<label for="basic-url" class="form-label">Your vanity URL</label>
128
<div class="input-group mb-3">
129
<span class="input-group-text border-0" id="basic-addon3"
130
>https://example.com/users/</span
131
>
132
<input
133
type="text"
134
class="form-control rounded"
135
id="basic-url"
136
aria-describedby="basic-addon3"
137
/>
138
</div>
139
140
<div class="input-group mb-3">
141
<span class="input-group-text border-0">$</span>
142
<input
143
type="text"
144
class="form-control rounded"
145
aria-label="Amount (to the nearest dollar)"
146
/>
147
<span class="input-group-text border-0">.00</span>
148
</div>
149
150
<div class="input-group">
151
<span class="input-group-text border-0">With textarea</span>
152
<textarea class="form-control rounded" aria-label="With textarea"></textarea>
153
</div>
154
</div>
155
<!--/ Copy this code to have a working example -->
156
</div>
157
158
159
160
</div>
CSS
1
1
JS
1
1
Console errors: 0