<div class="custom-div">
<p>ch5-select with width and height attributes set</p>
<ch5-select minWidth="250px" maxWidth="350px"
minHeight="36px" maxHeight="48px"
size="5" indexId="idx" noneSelectedPrompt="Select">
<template>
<ch5-select-option>
<div>
<span>item_{{idx}}</span>
</div>
</ch5-select-option>
</template>
</ch5-select>
</div>
<div class="custom-div">
<p>ch5-select without width and height attributes</p>
<ch5-select size="5" indexId="idx" noneSelectedPrompt="Select">
<template>
<ch5-select-option>
<div>
<span>item_{{idx}}</span>
</div>
</ch5-select-option>
</template>
</ch5-select>
</div>
<p>ch5-select with <strong>resize</strong> attribute. By default select panel width is equal with ch5-select width.
With resize true, select panel width is given by options width and cannot exceed ch5-select parent width</p>
<div class="custom-div">
<ch5-select id="resize-ex" resize maxWidth="250px" size="5" indexId="idx" noneSelectedPrompt="Select">
<template>
<ch5-select-option>
<div>
<span>item_{{idx}}</span>
</div>
</ch5-select-option>
</template>
</ch5-select>
<div style="margin-top: 24px">
<button id="toggle-resize" class="button is-info" type="button">Toggle ch5-select resize attribute</button>
</div>
</div>
document.getElementById('toggle-resize').addEventListener('click', function(){
const ch5select = document.getElementById('resize-ex');
if (ch5select.hasAttribute('resize')) {
ch5select.removeAttribute('resize');
} else {
ch5select.setAttribute('resize', true);
}
});
.custom-div {
padding: 24px 0;
}