Animal development involves numerous molecular events, whose spatiotemporal properties largely determine the biological outcomes. Conventional methods for studying gene function lack the necessary spatiotemporal resolution for precise dissection of developmental mechanisms. Optogenetic approaches are powerful alternatives, but most existing tools rely on exogenous designer proteins that produce narrow outputs and cannot be applied to diverse or endogenous proteins. To address this limitation, we developed OptoTrap, a light-inducible protein trapping system that allows manipulation of endogenous proteins tagged with GFP or split GFP. This system turns on fast and is reversible in minutes or hours. We generated OptoTrap variants optimized for neurons and epithelial cells and demonstrate effective trapping of endogenous proteins of diverse sizes, subcellular locations, and functions. Furthermore, OptoTrap allowed us to instantly disrupt microtubules and inhibit the kinesin-1 motor in specific dendritic branches ofDrosophilasensory neurons. Using OptoTrap, we obtained direct evidence that microtubules support the growth of highly dynamic dendrites. Similarly, targeted manipulation of Kinesin heavy chain revealed differential spatiotemporal requirements of kinesin-1 in the patterning of low- and high-order dendritic branches, suggesting that different cargos are needed for the growth of these branches. OptoTrap allows for precise manipulation of endogenous proteins in a spatiotemporal manner and thus holds great promise for studying developmental mechanisms in a wide range of cell types and developmental stages.