  This paper is, in a first stage, devoted to establish a
topological--algebraic characterization of the principal component,
$\mathcal{U}^0 (M)$, of the set of unitary elements, $\mathcal{U} (M)$, in a
unital JB$^*$-algebra $M$. We arrive to the conclusion that, as in the case of
unital C$^*$-algebras, $$\begin{aligned}\mathcal{U}^0(M) &=
M^{-1}_{\textbf{1}}\cap\mathcal{U} (M) =\left\lbrace U_{e^{i h_n}}\cdots
U_{e^{i h_1}}(\textbf{1}) \colon \begin{array}{c}
  n\in \mathbb{N}, \ h_j\in M_{sa}
  \forall\ 1\leq j \leq n
  \end{array}
  \right\rbrace \end{aligned}$$ is analytically arcwise connected. Our second
goal is to provide a complete description of the surjective isometries between
the principal components of two unital JB$^*$-algebras $M$ and $N$. Contrary to
the case of unital C$^*$-algebras, we shall deduce the existence of connected
components in $\mathcal{U} (M)$ which are not isometric as metric spaces. We
shall also establish necessary and sufficient conditions to guarantee that a
surjective isometry $\Delta: \mathcal{U}(M)\to \mathcal{U} (N)$ admits an
extension to a surjective linear isometry between $M$ and $N$, a conclusion
which is not always true. Among the consequences it is proved that $M$ and $N$
are Jordan $^*$-isomorphic if, and only if, their principal components are
isometric as metric spaces if, and only if, there exists a surjective isometry
$\Delta: \mathcal{U}(M)\to \mathcal{U}(N)$ mapping the unit of $M$ to an
element in $\mathcal{U}^0(N)$. These results provide an extension to the
setting of unital JB$^*$-algebras of the results obtained by O. Hatori for
unital C$^*$-algebras.
