External control over self-assembling structures is achieved by incorporating an azobenzene photoswitch into the structure of a dichromonyl compound. The self-assembly of dichromonyl compounds into fibers leads to the formation of a hydrogel and can be triggered with visible light.