IonModal is missing the "trigger" attribute

I want the IonModal to open when I click the IonIcon.

                        <IonIcon id="open-modal" icon={calendar} slot="start"/>
                        <IonModal trigger="open-modal">
                            <IonContent>
                                <IonDatetime></IonDatetime>
                            </IonContent>
                        </IonModal>

Right now the trigger property is giving me this error.

TS2322: Type '{ children: Element; trigger: string; }' is not assignable to type 'IntrinsicAttributes & Pick<ModalOptions<ComponentRef>, "id" | "mode" | ... etc.

Property 'trigger' does not exist on type 'IntrinsicAttributes & Pick<ModalOptions<ComponentRef>, "id" | "mode" | ... etc.

I looked at the declaration for IonModal in ionic/react and indeed I don’t see the trigger attribute. Has this not been implemented or something? I’m confused because it shows a working example just like this in the documentaiton.

^ referenced documentation

If u change the icon to a button, does it work then? If so, then I guess the trigger property may only go well with specific elements. A quick glance at the doc does not reveal a restriction that still can be present

Then u may need to toggle using a different way

Hi Tommertom. Not sure - I opted to just use the isOpen property instead, which has been working fine.