Any simple way to mimic the momentary switch?

Hi all,
I am in need of making a bidirectional switch using circuit to replace a momentary switch. After some time of searching, I could not find an easy way to do so.
However, I found MOC3021 (Optocoupler with triac output) seem to work but I have no chance to test it yet.
My question is:
Is it theoretically possible to use MOC3021 or anything else simple enough to act as a switch with bidirectional current that a momentary switch does?
Thanks for your attention

So I understand your goal...

If you put current through the input LED, the output will turn on for an equal amount of time (maybe + 1/2 sine wave).

There is no momentary function in the MOC3021 for the most part it acts like a relay.

You did not mention the speed of the pulse to turn the MOC3021, if it is very fast there are more things to consider.

What are you switching? AC or DC? voltage? current?

JCA34F:
What are you switching? AC or DC? voltage? current?

Sorry for not replying on time. This is what I am trying to make

What I want is to develop a standalone relay that can operate manually with a touch button and also via MCU over the internet.
Quite struggling but I finally have the way out with mosfet, My schematic is here
Part 1: Latching module to control the Optocoupler (see attached image)
Part 2: Mimic the Momentary switch (see attached image)

Please advice me if you see anything that needed some change with thanks!
R7 is output to pin 1 on the MOC3021 or MOC3041 to control the triac! What I iam trying to do is to find a way to replace the momentary SW

1img.jpg

2.img.jpg