Radio
Radio component allows to use forms input typed to radio element.
Quick demo
Preview of the radio component.
Go on interactive demo for look this component in action!
Usage
Styles
sass
@use "~@iraiser/biscuit-design-components/components/radio/styles";
JavaScript
javascript
import { BDCRadio } from '@iraiser/biscuit-design-components/components/radio';
let radio = new BDCRadio(document.querySelector('.bdc-radio'));
HTML structure
html
<div class="bdc-radio">
<input class="bdc-radio__input" type="radio">
<div class="bdc-radio__control">
<span class="bdc-radio__circle"></span>
</div>
<div class="bdc-radio__whisper"></div>
</div>
Theming
See the "Theming" section on theme documentation for more customization options.
Theming with CSS custom properties
Set custom styles on specific element in component:
sass
@use "~@iraiser/biscuit-design-components/components/radio";
.foo-radio {
--bdc-theme-primary: #0971b3;
}
Theming with Sass mixins
Set custom styles on specific element in component:
sass
@use "~@iraiser/biscuit-design-components/components/radio";
.foo-radio {
@include radio.ink-color(#0971b3);
}
See Sass mixins section for more options.
Style customization
CSS classes
CSS Class | Description |
---|---|
bdc-radio | Mandatory. |
bdc-radio--focused | Style radio at focused status. |
bdc-radio--required | Style radio at required status. |
bdc-radio--invalid | Style radio at invalid status. |
bdc-radio--disabled | Style radio at disabled status. |
bdc-radio__input | Indicates the native input container. |
bdc-radio__control | Indicates the control container. |
bdc-radio__circle | Indicates the dot container. |
Sass mixins
Custom your own radio easily with the public Sass mixins.
Mixin | Description |
---|---|
unchecked-colors($stroke-color, $fill-color) | Set the colors when element is not checked. |
checked-colors($stroke-color, $fill-color) | Set the colors when element is checked. |
ink-color($color) | Set the circle color when element is checked. |
focused-color($color) | Set the color when element is focused. |
JavaScript API
Getters & Setters
Public accessors from BDCRadio
class.
Accessor | Type | Description |
---|---|---|
value | string | Method for get & set the value. |
checked | boolean | Method for get & set the checked status. |
valid | boolean | Method for get & set the valid status. |
required | boolean | Method for get & set the required status. |
disabled | boolean | Method for get & set the disabled status. |