As chief executive, he can decide to declassify material as he sees fit. Usually there are procedures to ensure that the information released does not damage sources or negatively interferes with other operations, etc. In the most recent case, Trump shared information gathered by another country and that violates the usual agreement that the source dictates how that information may be shared.
So Trump did not violate any law, he is correct in saying it was his right. However, it is potentially very damaging to the usefulness of the intel, the relationship with Israel (they may not want to share intel with us as freely) and could get the person working for the Israeli intel agency killed (it may have come from an inside agent who has now been compromised).