Selects enable users to choose a single item from a list of items.
<script src="https://cdn.jsdelivr.net/npm/rainforest-web-components@latest/components/select.js" type="module"></script>
<rf-select></rf-select>
<rf-select></rf-select>
<rf-select></rf-select>
<rf-select trigger-variant="option"></rf-select>
const selects = document.querySelectorAll( 'rf-select' );
selects[0].options = [
{label: 'Option 1', value: 1},
{label: 'Option 2', value: 2},
{label: 'Option 3', value: 3},
{label: 'Option 4', value: 4},
{label: 'Option 5', value: 5}
];
selects[1].options = [
{label: 'Option 1', value: 1, iconName: 'settings'},
{label: 'Option 2', value: 1, iconName: 'unlock'},
{label: 'Option 3', value: 1, iconName: 'share'}
];
selects[2].options = [
{label: 'Option 1', value: 1, tags: ['OptionTag1', 'Tag2', 'Tag3']},
{label: 'Option 2', value: 1, tags: ['OptionTag1', 'Tag2', 'Tag3']}
];
selects[3].options = [
{label: 'Option 1', value: 1, labelTag: '128Gb', iconName: 'settings', description: 'sub value', tags: ['CPU-v2', '2Gb RAM']},
{label: 'Option 2', value: 2, labelTag: '128Gb', iconName: 'settings', description: 'sub value', tags: ['CPU-v2', '2Gb RAM']},
{label: 'Option 3', value: 3, labelTag: '128Gb', iconName: 'settings', description: 'sub value', tags: ['CPU-v2', '2Gb RAM']}
];
selects[0].selectedOption = {label: 'Option 1', value: 1};
selects[1].selectedOption = {label: 'Option 1', value: 1, iconName: 'settings'};
selects[2].selectedOption = {label: 'Option 1', value: 1, tags: ['OptionTag1', 'Tag2', 'Tag3']};
selects[3].selectedOption = {label: 'Option 1', value: 1, labelTag: '128Gb', iconName: 'settings', description: 'sub value', tags: ['CPU-v2', '2Gb RAM']};