7. The equation $x^{2}-a|x|+a^{2}-3=0$ has a unique real solution for $x$, then $a=$ $\qquad$ .
7. $-\sqrt{3}$.

From the problem, we know that if the original equation has only one real solution, then $x=0$.

Substituting $x=0$ into the original equation, we get $a= \pm \sqrt{3}$, where $a=\sqrt{3}$ does not meet the requirements of the problem, so it is discarded.
Thus, $a=-\sqrt{3}$.