That was one reason. There were multiple reasons, but the biggest was the failure of the federal government to recognize states' sovereignty in their affairs. The repeated overreach of congress into state matters was absolutely the biggest reason. Tariffs and slavery were just symptoms of what were much, much bigger issues of abuse and overreach. The South was left with no recourse but to separate and secede, which was absolutely legal according to the precedent and legal doctrine at the time.