Skip to content

Commit facbea8

Browse files
committed
fix: make field to have an required indicator
1 parent 88d7755 commit facbea8

File tree

4 files changed

+45
-15
lines changed

4 files changed

+45
-15
lines changed

docs/app/pages/Components/Checkbox/examples/RegularCheckboxes.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<template>
22
<div>
3-
<md-checkbox v-model="array" value="1">Array Checkbox</md-checkbox>
4-
<md-checkbox v-model="array" value="2">Array Checkbox</md-checkbox>
5-
<md-checkbox v-model="boolean" :value="false">Boolean Checkbox</md-checkbox>
6-
<md-checkbox v-model="string" value="my-checkbox">String Checkbox</md-checkbox>
7-
<md-checkbox v-model="novalue">No Value Checkbox</md-checkbox>
3+
<md-checkbox v-model="array" value="1">Array</md-checkbox>
4+
<md-checkbox v-model="array" value="2">Array</md-checkbox>
5+
<md-checkbox v-model="boolean" :value="false">Boolean</md-checkbox>
6+
<md-checkbox v-model="string" required value="my-checkbox">String <small>(required)</small></md-checkbox>
7+
<md-checkbox v-model="novalue">No Value</md-checkbox>
8+
<md-checkbox v-model="novalue" disabled>Disabled</md-checkbox>
89

910
<table>
1011
<tr>
11-
<th>Array Checkbox</th>
12-
<th>Boolean Checkbox</th>
13-
<th>String Checkbox</th>
14-
<th>No Value Checkbox</th>
12+
<th>Array</th>
13+
<th>Boolean</th>
14+
<th>String</th>
15+
<th>No Value</th>
1516
</tr>
1617

1718
<tr>

docs/app/pages/Components/Radio/examples/RegularRadio.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<template>
22
<div>
3-
<md-radio v-model="radio" :value="false">Boolean Radio</md-radio>
4-
<md-radio v-model="radio" value="my-Radio">String Radio</md-radio>
5-
<md-radio v-model="radio">No Value Radio</md-radio>
3+
<md-radio v-model="radio" :value="false">Boolean</md-radio>
4+
<md-radio v-model="radio" value="my-radio">String</md-radio>
5+
<md-radio v-model="radio">No Value</md-radio>
6+
<md-radio v-model="radio" disabled>Disabled</md-radio>
67

7-
Radio value: {{ radio }}
8+
Model value: {{ radio }}
89
</div>
910
</template>
1011

src/components/MdCheckbox/MdCheckbox.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
checkboxClasses () {
6666
return {
6767
'md-checked': this.isSelected,
68-
'md-disabled': this.disabled
68+
'md-disabled': this.disabled,
69+
'md-required': this.required
6970
}
7071
}
7172
},
@@ -196,6 +197,7 @@
196197
.md-checkbox-label {
197198
height: $md-checkbox-size;
198199
padding-left: 16px;
200+
position: relative;
199201
line-height: $md-checkbox-size;
200202
}
201203
}
@@ -215,5 +217,17 @@
215217
border-color: transparent !important;
216218
}
217219
}
220+
221+
.md-checkbox.md-required {
222+
label:after {
223+
position: absolute;
224+
top: 2px;
225+
right: 0;
226+
transform: translateX(calc(100% + 2px));
227+
content: "*";
228+
line-height: 1em;
229+
vertical-align: top;
230+
}
231+
}
218232
</style>
219233

src/components/MdRadio/MdRadio.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
radioClasses () {
5252
return {
5353
'md-checked': this.isSelected,
54-
'md-disabled': this.disabled
54+
'md-disabled': this.disabled,
55+
'md-required': this.required
5556
}
5657
}
5758
},
@@ -146,6 +147,7 @@
146147
.md-radio-label {
147148
height: $md-radio-size;
148149
padding-left: 16px;
150+
position: relative;
149151
line-height: $md-radio-size;
150152
}
151153
}
@@ -159,5 +161,17 @@
159161
}
160162
}
161163
}
164+
165+
.md-radio.md-required {
166+
label:after {
167+
position: absolute;
168+
top: 2px;
169+
right: 0;
170+
transform: translateX(calc(100% + 2px));
171+
content: "*";
172+
line-height: 1em;
173+
vertical-align: top;
174+
}
175+
}
162176
</style>
163177

0 commit comments

Comments
 (0)