Selected button
Selected Button component display styled radio or checkbox element like a button dedicated for single or multiple choice.
Quick demo
Preview of the selected button component.
Go on interactive demo for look this component in action!
Usage
Styles
sass
@use "~@iraiser/biscuit-design-components/components/selected-button/styles";
JavaScript
javascript
import { BDCSelectedButton } from '@iraiser/biscuit-design-components/selected-button';
let amount = new BDCSelectedButton(document.querySelector('.bdc-selected-button'));
HTML structure
html
<label class="bdc-selected-button">
<input class="bdc-selected-button__input" type="radio">
<div class="bdc-selected-button__control">
<span class="bdc-selected-button__label">$60</span>
</div>
</label>
Variants
Checkbox
Use checkbox type for multiple choice.
html
<label class="bdc-selected-button">
<input class="bdc-selected-button__input" type="checkbox">
<div class="bdc-selected-button__control">
<span class="bdc-selected-button__label">$60</span>
</div>
</label>
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/selected-button";
.foo-selected-button {
--bdc-theme-primary: #0971b3;
--bdc-theme-on-primary: #fff;
}
Theming with Sass mixins
Set custom styles on specific element in component:
sass
@use "~@iraiser/biscuit-design-components/components/selected-button";
.foo-selected-button {
@include selected-button.unselected-colors(#0971b3);
}
See Sass mixins section for more options.
Style customization
CSS classes
CSS Class | Description |
---|---|
bdc-selected-button | Mandatory. |
bdc-selected-button--focused | Style selected button at focused status. |
bdc-selected-button--disabled | Style selected button at disabled status. |
bdc-selected-button__input | Indicates the native input container. |
bdc-selected-button__control | Indicates the native control container. |
bdc-selected-button__label | Indicates the label container. |
Sass mixins
Custom your own progress bar easily with the public Sass mixins.
Mixin | Description |
---|---|
unselected-colors($fill-color, $stroke-color, $ink-color) | Set the colors on the button when is unselected. |
selected-colors($fill-color, $stroke-color, $ink-color) | Set the colors on the button when is selected. |
shape-radius($radius) | Set the radius on the button. |
density($scale) | Set the density on the button. |
JavaScript API
Getters & Setters
Public accessors from BDCSelectedButton
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. |
disabled | boolean | Method for "get" & "set" the disabled status. |