Grouping
The fieldset and legend are used to group related form elements and to define a caption. Use the classes .ox-form__fieldset
and .ox-form__legend
to style them.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<div class="ox-panel">
<fieldset class="ox-form__fieldset">
<legend class="ox-form__legend">User information</legend>
<div class="ox-form__row">
<div class="ox-form__group">
<label class="ox-form__label" for="form-gender">Gender</label>
<select id="form-gender" class="ox-form__field">
<option>M</option>
<option>F</option>
<option>X</option>
</select>
</div>
<div class="ox-form__group">
<label class="ox-form__label" for="form-firstname">First name</label>
<input type="text" id="form-firstname" class="ox-form__field" />
</div>
<div class="ox-form__group">
<label class="ox-form__label" for="form-lastname">Last name</label>
<input type="text" for="form-firstname" class="ox-form__field" />
</div>
</div>
</fieldset>
</div>
Small Grouping
If there isn't much space available you can add the class ox-form__field--small
to the select & input fields.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<div class="ox-panel">
<fieldset class="ox-form__fieldset">
<legend class="ox-form__legend">User information</legend>
<div class="ox-form__row">
<div class="ox-form__group">
<label class="ox-form__label" for="form-gender">Gender</label>
<select id="form-gender" class="ox-form__field ox-form__field--small">
<option>M</option>
<option>F</option>
<option>X</option>
</select>
</div>
<div class="ox-form__group">
<label class="ox-form__label" for="form-firstname">First name</label>
<input type="text" id="form-firstname" class="ox-form__field ox-form__field--small" />
</div>
<div class="ox-form__group">
<label class="ox-form__label" for="form-lastname">Last name</label>
<input type="text" for="form-firstname" class="ox-form__field ox-form__field--small" />
</div>
</div>
</fieldset>
</div>
Rows
Wrap multiple form groups in a .ox-form__row
to distribute the elements evenly over a row, the modifier .ox-form__row--narrow
can be added for smaller rows.
As mentioned before, all the elements will be distributed evenly over the row, but if a fixed width is desired, you can add the modifier .ox-form__group--fixed-size
to the form group and (if needed) specify the width of an input field by adding a size
attribute to it.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<div class="ox-panel">
<fieldset class="ox-form__fieldset">
<legend class="ox-form__legend">Customer info</legend>
<div class="ox-form__row">
<div class="ox-form__group">
<label class="ox-form__label" for="interest">Source of interest</label>
<input type="text" id="interest" class="ox-form__field" />
</div>
</div>
<div class="ox-form__row">
<div class="ox-form__group">
<label class="ox-form__label" for="customer">Customer</label>
<div class="ox-input-group">
<input type="text" id="customer" class="ox-form__field" />
</div>
</div>
<div class="ox-form__group">
<label class="ox-form__label" for="po">PO or additional info</label>
<input type="text" id="po" class="ox-form__field" />
</div>
</div>
</fieldset>
</div>
<div class="ox-panel">
<fieldset class="ox-form__fieldset">
<legend class="ox-form__legend">Address info</legend>
<div class="ox-form__row ox-form__row--narrow">
<div class="ox-form__group">
<label class="ox-form__label" for="street">Street</label>
<input type="text" id="street" class="ox-form__field" />
</div>
<div class="ox-form__group ox-form__group--fixed-size">
<label class="ox-form__label" for="number">Nr.</label>
<input type="text" id="number" size="6" class="ox-form__field" />
</div>
</div>
<div class="ox-form__row ox-form__row--narrow">
<div class="ox-form__group ox-form__group--fixed-size">
<label class="ox-form__label" for="zip">ZIP code</label>
<input type="text" id="zip" size="6" class="ox-form__field" />
</div>
<div class="ox-form__group">
<label class="ox-form__label" for="city">City</label>
<input type="text" id="city" class="ox-form__field" />
</div>
</div>
<div class="ox-form__row ox-form__row--narrow">
<div class="ox-form__group">
<label class="ox-form__label" for="country">Country</label>
<select class="ox-form__field" id="country">
<option>Belgium</option>
<option>France</option>
<option>Germany</option>
<option>Spain</option>
</select>
</div>
</div>
</fieldset>
</div>