Result true:
How to change 100% width depending on ion-select width see attached image.
Can you help me?
Result true:
How to change 100% width depending on ion-select width see attached image.
Can you help me?
Something like this is a good start for you. StackBlitz example. Sorry it’s Vue since I am a Vue guy ![]()
<template>
<ion-select
class="select-fullwidth-popover"
aria-label="Fruit"
interface="popover"
placeholder="Select fruit"
:interface-options="customPopoverOptions"
>
<ion-select-option value="apples">Apples</ion-select-option>
<ion-select-option value="oranges">Oranges</ion-select-option>
<ion-select-option value="bananas">Bananas</ion-select-option>
</ion-select>
</template>
<style>
ion-select {
width: 300px;
}
ion-select::part(container) {
width: 100%;
}
</style>
<script setup>
import { IonList, IonItem, IonSelect, IonSelectOption } from '@ionic/vue';
import { onMounted } from 'vue';
const customPopoverOptions = {
size: 'cover',
};
onMounted(() => {
const sheet = new CSSStyleSheet();
sheet.replaceSync('.select-wrapper-inner { flex-grow: 1; }');
document.querySelectorAll('.select-fullwidth-popover').forEach((selectEl) => {
selectEl.shadowRoot.adoptedStyleSheets.push(sheet);
});
});
</script>
Thank you so much. But I used ionic 8
My example is using Ionic 8.