Skip to content

Commit a574561

Browse files
authored
Merge pull request #455 from rackerlabs/surf-584-forms-radio-button
[^459] feat(hx-radio-control): surf-584 phase I radio form control
2 parents a2ca506 + b17eda4 commit a574561

File tree

8 files changed

+1100
-2
lines changed

8 files changed

+1100
-2
lines changed

docs/components/radios/index.html

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,63 @@
99
{% block content %}
1010
<section>
1111
<h2 id="basic-radio">Basic Radio</h2>
12-
<p>TBD</p>
12+
<div class="example" id="vue-radioDemo" v-cloak>
13+
<header>
14+
<form class="beta-hxForm">
15+
<p>
16+
<label for="txtLabel">Label</label>
17+
<input id="txtLabel" class="hxTextCtrl" v-model="label" />
18+
</p>
19+
<fieldset>
20+
<legend class="beta-hxFieldName">Options</legend>
21+
<hx-checkbox-control>
22+
<input id="chkIsChecked" type="checkbox" v-model="isChecked" />
23+
<label for="chkIsChecked">
24+
<hx-checkbox></hx-checkbox>
25+
Checked
26+
</label>
27+
</hx-checkbox-control>
28+
<hx-checkbox-control>
29+
<input id="chkIsDisabled" type="checkbox" v-model="isDisabled" />
30+
<label for="chkIsDisabled">
31+
<hx-checkbox></hx-checkbox>
32+
Disabled
33+
</label>
34+
</hx-checkbox-control>
35+
<hx-checkbox-control>
36+
<input id="chkIsRequired" type="checkbox" v-model="isRequired" />
37+
<label for="chkIsRequired">
38+
<hx-checkbox></hx-checkbox>
39+
Required
40+
</label>
41+
</hx-checkbox-control>
42+
</fieldset>
43+
</form>
44+
</header>
45+
<div>
46+
<hx-radio-control>
47+
<input
48+
type="radio"
49+
id="radDemo"
50+
:checked="isChecked"
51+
:disabled="isDisabled"
52+
:required="isRequired"
53+
/>
54+
<label for="radDemo">
55+
<hx-radio></hx-radio>
56+
{% raw %}{{label}}{% endraw %}
57+
</label>
58+
</hx-radio-control>
59+
</div>
60+
<footer>
61+
<pre><code v-text="snippet"></code></pre>
62+
</footer>
63+
</div>
64+
<p class="hxSubdued hxSubBody">
65+
<hx-icon type="info-circle"></hx-icon>
66+
Webkit-based browsers (e.g., Chrome, Safari, etc.) do not match the
67+
<code>:required</code> CSS psuedo-class to radios in a single-item
68+
radio group.
69+
</p>
1370
</section>
1471
{% endblock %}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import Util from '../../_util';
2+
3+
if (document.getElementById('vue-radioDemo')) {
4+
new Vue({
5+
el: '#vue-radioDemo',
6+
data: {
7+
isChecked: false,
8+
isDisabled: false,
9+
isRequired: false,
10+
label: 'Radio Label',
11+
},
12+
computed: {
13+
snippet: function () {
14+
return Util.snippet(`
15+
<hx-radio-control>
16+
<input
17+
type="radio"
18+
id="radDemo"
19+
${this.isChecked ? 'checked' : ''}
20+
${this.isDisabled ? 'disabled' : ''}
21+
${this.isRequired ? 'required' : ''}
22+
/>
23+
<label for="radDemo">
24+
<hx-radio></hx-radio>
25+
${this.label}
26+
</label>
27+
</hx-radio-control>
28+
`);
29+
},
30+
},
31+
});
32+
}

0 commit comments

Comments
 (0)