JSFiddle - React, Tailwind, and code Playground
HTML
<input id="radio-yes" type="radio" name="radio" checked />
<label for="radio-yes">Yes</label>
<input id="radio-no" type="radio" name="radio" />
<label for="radio-no">No</label>
<div class="yes-only">
Visible on "Yes".
</div>
<div class="yes-or-no">
Visible on "Yes" or "No".
</div>
CSS
body {
line-height: 1.2;
}
.yes-only {
transition: height 0.5s ease-in-out;
overflow: hidden;
}
#radio-yes:checked ~ .yes-only {
height: calc(1em * 1.2);
}
#radio-no:checked ~ .yes-only {
height: 0;
}