mirror of
https://github.com/primer/css.git
synced 2024-12-29 17:12:27 +03:00
Merge pull request #979 from primer/radio-group
Add `.radio-group` component
This commit is contained in:
commit
6fecbe289a
@ -305,6 +305,23 @@ Content that is hidden by default should only be done so if it is non-essential
|
||||
</form>
|
||||
```
|
||||
|
||||
#### Radio group
|
||||
|
||||
Radio groups are tab like controls. Their blue border gives extra emphasis to what is selected.
|
||||
|
||||
```html live
|
||||
<form>
|
||||
<div class="radio-group">
|
||||
<input class="radio-input" id="option-a" type="radio" name="options">
|
||||
<label class="radio-label" for="option-a">Option A</label>
|
||||
<input class="radio-input" id="option-b" type="radio" name="options">
|
||||
<label class="radio-label" for="option-b">Option B</label>
|
||||
<input class="radio-input" id="option-c" type="radio" name="options">
|
||||
<label class="radio-label" for="option-c">Option C</label>
|
||||
</div>
|
||||
</form>
|
||||
```
|
||||
|
||||
#### Input group
|
||||
|
||||
Attached an input and button to one another.
|
||||
|
@ -4,3 +4,4 @@
|
||||
@import "./form-group.scss";
|
||||
@import "./form-validation.scss";
|
||||
@import "./input-group.scss";
|
||||
@import "./radio-group.scss";
|
||||
|
43
src/forms/radio-group.scss
Normal file
43
src/forms/radio-group.scss
Normal file
@ -0,0 +1,43 @@
|
||||
// Tab like radio group
|
||||
|
||||
.radio-group {
|
||||
@include clearfix;
|
||||
}
|
||||
|
||||
.radio-label {
|
||||
float: left;
|
||||
// stylelint-disable-next-line primer/spacing
|
||||
padding: 6px $spacer-3 6px ($spacer-3 + 12px + $spacer-2); // 12px is the size of the radio-input
|
||||
// stylelint-disable-next-line primer/spacing
|
||||
margin-left: -1px;
|
||||
font-size: $body-font-size;
|
||||
// stylelint-disable-next-line primer/typography
|
||||
line-height: 20px; // Specifically not inherit our `<body>` default
|
||||
color: $text-gray-dark;
|
||||
cursor: pointer;
|
||||
border: $border-width $border-style $border-gray-dark;
|
||||
|
||||
:checked + & {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
border-color: $border-blue;
|
||||
}
|
||||
|
||||
&:first-of-type {
|
||||
margin-left: 0;
|
||||
border-top-left-radius: $border-radius;
|
||||
border-bottom-left-radius: $border-radius;
|
||||
}
|
||||
|
||||
&:last-of-type {
|
||||
border-top-right-radius: $border-radius;
|
||||
border-bottom-right-radius: $border-radius;
|
||||
}
|
||||
}
|
||||
|
||||
.radio-input {
|
||||
z-index: 3;
|
||||
float: left;
|
||||
// stylelint-disable-next-line primer/spacing
|
||||
margin: 10px (-$spacer-5) 0 $spacer-3;
|
||||
}
|
Loading…
Reference in New Issue
Block a user