JSFiddle - React, Tailwind, and code Playground
Awesome Toggle UI
by tonytlwu
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="form-group">
<div class="col-xs-12 text-center">
<div class="radio-buttons clearfix">
<div class="radio">
<input type="radio" id="agent" name="agent-joe" value="Secret Agent" checked>
<label for="agent">
<i class="fa fa-user-secret" aria-hidden="true"></i>
<p>Secret Agent</p>
</label>
<div class="or-divider"><i class="fa fa-arrow-left"></i></div>
</div>
<div class="radio">
<input type="radio" id="joe" name="agent-joe" value="Average Joe">
<label for="joe">
<i class="fa fa-user" aria-hidden="true"></i>
<p>Average Joe</p>
</label>
<div class="or-divider"><i class="fa fa-arrow-right"></i></div>
</div>
</div>
</div>
</div>
CSS
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700);
html,
body {
font-family: "Open Sans", "Helvetica Neue", Arial, Helvetica, sans-serif;
background: #fbfbfb;
}
.radio-buttons {
display: inline-block;
position: relative;
}
.radio > .or-divider {
position: absolute;
width: 38px;
height: 38px;
top: 50%;
margin-top: -19px;
z-index: 10;
background-color: #fff;
border: 1px solid #e4e9eb;
border-radius: 4px;
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.2);
text-align: center;
line-height: 38px;
color: #00abd1;
pointer-events: none;
transform: rotateY(90deg);
opacity: 0;
transition: all 0.6s;
}
input[type="radio"]:checked ~ .or-divider {
transform: rotateY(0);
opacity: 1;
}
.radio:nth-child(1) > .or-divider {
right: 0;
margin-right: -19px;
}
.radio:nth-child(2) > .or-divider {
left: 0;
margin-left: -19px;
}
.radio input {
display: none;
}
.radio {
float: left;
margin: 0;
}
.radio label {
min-width: 175px;
position: relative;
border: 1px solid #e4e9eb;
border-radius: 0;
background-color: #FFFFFF;
color: #bbb;
padding: 30px 45px;
margin-left: 0;
margin-bottom: 0;
text-align: center;
}
.radio label .fa {
font-size: 5em;
margin-bottom: 20px;
}
.radio label p {
margin: 0;
}
.radio:first-child label {
border-right: none;
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
.radio + .radio label {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
.radio input[type="radio"]:checked + label {
background-color: #00abd2;
color: #FFF;
text-shadow: 0px 1px 4px rgba(0, 0, 0, 0.3);
}
.radio + .radio {
margin: 0;
}