Specifically, West Virginia State Board of Education v. Barnette, decided by the Supreme Court in 1943:
The Fourteenth Amendment, as now applied to the States, protects the citizen against the State itself and all of its creatures -- Boards of Education not excepted. These have, of course, important, delicate, and highly discretionary functions, but none that they may not perform within the limits of the Bill of Rights. That they are educating the young for citizenship is reason for scrupulous protection of Constitutional freedoms of the individual, if we are not to strangle the free mind at its source and teach youth to discount important principles of our government as mere platitudes.
Such Boards are numerous, and their territorial jurisdiction often small. But small and local authority may feel less sense of responsibility to the Constitution, and agencies of publicity may be less vigilant in calling it to account. The action of Congress in making flag observance voluntary and respecting the conscience of the objector in a matter so vital as raising the Army contrasts sharply with these local regulations in matters relatively trivial to the welfare of the nation. There are village tyrants, as well as village Hampdens, but none who acts under color of law is beyond reach of the Constitution...
If there is any fixed star in our constitutional constellation, it is that no official, high or petty, can prescribe what shall be orthodox in politics, nationalism, religion, or other matters of opinion, or force citizens to confess by word or act their faith therein. If there are any circumstances which permit an exception, they do not now occur to us.Among the rights students retain at the public schoolhouse door is that of refraining from pledging allegiance to the flag.
We think the action of the local authorities in compelling the flag salute and pledge transcends constitutional limitations on their power, and invades the sphere of intellect and spirit which it is the purpose of the First Amendment to our Constitution to reserve from all official control.