@@ -9,19 +9,11 @@ elements:
9
9
file : styles/native/radio.css
10
10
---
11
11
12
- <style >
13
- label {
14
- display : inline-block ;
15
- }
16
-
17
- label + label {
18
- margin-inline-start : var (--wa-space );
19
- }
20
- </style >
21
-
22
12
``` html {.example}
23
- <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
24
- <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
13
+ <div class =" wa-cluster" >
14
+ <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
15
+ <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
16
+ </div >
25
17
```
26
18
27
19
## Examples
@@ -31,47 +23,71 @@ file: styles/native/radio.css
31
23
To set the initial value and checked state, use the ` checked ` attribute on the corresponding radio.
32
24
33
25
``` html {.example}
34
- <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
35
- <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
36
- <label ><input type =" radio" name =" radio" value =" 3" checked > Option 3</label >
26
+ <div class =" wa-cluster" >
27
+ <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
28
+ <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
29
+ <label ><input type =" radio" name =" radio" value =" 3" checked > Option 3</label >
30
+ </div >
37
31
```
38
32
39
33
### Disabled
40
34
41
35
Use the ` disabled ` attribute to disable a radio.
42
36
43
37
``` html {.example}
44
- <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
45
- <label ><input type =" radio" name =" radio" value =" 2" disabled > Option 2</label >
46
- <label ><input type =" radio" name =" radio" value =" 3" > Option 3</label >
38
+ <div class =" wa-cluster" >
39
+ <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
40
+ <label ><input type =" radio" name =" radio" value =" 2" disabled > Option 2</label >
41
+ <label ><input type =" radio" name =" radio" value =" 3" > Option 3</label >
42
+ </div >
47
43
```
48
44
49
45
### Sizes
50
46
51
47
Use the [ size utilities] ( /docs/utilities/size ) to change the radios' size.
52
48
53
49
``` html {.example}
54
- <fieldset class =" wa-size-s" >
55
- <legend >Small</legend >
56
- <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
57
- <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
58
- <label ><input type =" radio" name =" radio" value =" 3" > Option 3</label >
50
+ <fieldset class =" wa-size-s wa-cluster " >
51
+ <legend >Small</legend >
52
+ <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
53
+ <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
54
+ <label ><input type =" radio" name =" radio" value =" 3" > Option 3</label >
59
55
</fieldset >
60
56
61
57
<br />
62
- <fieldset class =" wa-size-m" >
63
- <legend >Medium</legend >
64
- <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
65
- <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
66
- <label ><input type =" radio" name =" radio" value =" 3" > Option 3</label >
58
+ <fieldset class =" wa-size-m wa-cluster " >
59
+ <legend >Medium</legend >
60
+ <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
61
+ <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
62
+ <label ><input type =" radio" name =" radio" value =" 3" > Option 3</label >
67
63
</fieldset >
68
64
69
65
<br />
70
66
71
- <fieldset class =" wa-size-l" >
72
- <legend >Large</legend >
73
- <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
74
- <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
75
- <label ><input type =" radio" name =" radio" value =" 3" > Option 3</label >
67
+ <fieldset class =" wa-size-l wa-cluster " >
68
+ <legend >Large</legend >
69
+ <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
70
+ <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
71
+ <label ><input type =" radio" name =" radio" value =" 3" > Option 3</label >
76
72
</fieldset >
77
73
```
74
+
75
+ ### Orientation
76
+
77
+ You can wrap native radios in a flex container to give them a horizontal or vertical orientation with even spacing. The convenience [ ` wa-cluster ` ] ( /docs/utilities/cluster ) and [ ` wa-stack ` ] ( /docs/utilities/stack ) utilities make this easy.
78
+
79
+ ``` html {.example}
80
+ <div class =" wa-cluster" >
81
+ <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
82
+ <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
83
+ <label ><input type =" radio" name =" radio" value =" 3" checked > Option 3</label >
84
+ </div >
85
+ ```
86
+
87
+ ``` html {.example}
88
+ <div class =" wa-stack" >
89
+ <label ><input type =" radio" name =" radio" value =" 1" > Option 1</label >
90
+ <label ><input type =" radio" name =" radio" value =" 2" > Option 2</label >
91
+ <label ><input type =" radio" name =" radio" value =" 3" checked > Option 3</label >
92
+ </div >
93
+ ```
0 commit comments