Select
Select component allows to use forms select element.
Quick demo
Preview of the select component associated with label and helper text.
Helper message.
Go on interactive demo for look this component in action!
Usage
Styles
@use "~@iraiser/biscuit-design-components/components/select/styles";
JavaScript
import { BDCSelect } from '@iraiser/biscuit-design-components/components/select';
let select = new BDCSelect(document.querySelector('.bdc-select'));
HTML structure
<div class="bdc-select">
<div class="bdc-select__wrap">
<select class="bdc-select__control">
<option>...</option>
</select>
</div>
<i class="bdc-select__dropdown-icon fa-angle-down fas"></i>
</div>
Variants
Leading icon
The leading and trailing icons can add a new context on select. You can add leading, trailing or both. This highly recommended to not use icons with textarea option.
To see more information on using icon, go here.
<div class="bdc-select bdc-select--leading-icon">
<i class="bdc-select__icon fa-star fas"></i>
<div class="bdc-select__wrap">
<select class="bdc-select__control">
<option>...</option>
</select>
</div>
<i class="bdc-select__dropdown-icon fa-angle-down fas"></i>
</div>
Placeholder
The component support natively the placeholder option
, this option
need have empty value
.
<div class="bdc-select bdc-select--leading-icon">
<div class="bdc-select__wrap">
<select class="bdc-select__control">
<option value="" selected="selected">Select an option...</option>
<option>...</option>
</select>
</div>
<i class="bdc-select__dropdown-icon fa-angle-down fas"></i>
</div>
Other variations
Using with label
<label class="bdc-label" for="select">Select</label>
<div class="bdc-select">
<div class="bdc-select__wrap">
<select class="bdc-select__control" id="select">
<option>...</option>
</select>
</div>
<i class="bdc-select__dropdown-icon fa-angle-down fas"></i>
</div>
For more details, please see Label component.
Using with helper text
<div class="bdc-select">
<div class="bdc-select__wrap">
<select class="bdc-select__control">
<option>...</option>
</select>
</div>
<i class="bdc-select__dropdown-icon fa-angle-down fas"></i>
</div>
<div class="bdc-select-helper">
<p class="bdc-select-helper-text">Information text</p>
</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:
@use "~@iraiser/biscuit-design-components/components/select";
.foo-select {
--bdc-theme-surface: #0971b3;
}
Theming with Sass mixins
Set custom styles on specific element in component:
@use "~@iraiser/biscuit-design-components/components/select";
.foo-select {
@include selected-button.shape-radius(sharped);
}
See Sass mixins section for more options.
Style customization
CSS classes
CSS Class | Description |
---|---|
bdc-select | Mandatory. |
bdc-select--focused | Style select at focused status. |
bdc-select--selected | Style select at selected status. |
bdc-select--required | Style select at required status. |
bdc-select--valid | Style select at valid status. |
bdc-select--warning | Style select at warning status. |
bdc-select--invalid | Style select at invalid status. |
bdc-select--disabled | Style select at disabled status. |
bdc-select--leading-icon | Style select at leading icon. |
bdc-select__control | Indicates the native control container. |
bdc-select__dropdown-icon | Indicates the dropdown icon container. |
bdc-select__icon | Indicates the icon container. |
bdc-select-helper | Indicates the helper container. |
bdc-select-helper-text | Indicates the helper text container. |
bdc-select-helper-text--persistent | Persist the helper text container display. |
bdc-select-helper-text--validation-msg | Indicates the helper text validation message container. |
Sass mixins
Custom your own selected button easily with the public Sass mixins.
Mixin | Description |
---|---|
ink-color($color) | Set the ink color when select is enable. |
shape-radius($radius) | Set the radius on select. |
dropdown-icon-color($color) | Set the color on dropdown icon. |
density($scale) | Set the density on text field. |
JavaScript API
Getters & Setters
Public accessors from BDCSelect
class.
Accessor | Type | Description |
---|---|---|
value | string | Method for get & set the value. |
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. |
helperText | string | Method for set the suffix text. |
Options
Name | Default | Description |
---|---|---|
useNativeValidation | true | Enable or disabled the form validation. |