  We present the methods devised to identify the BY Dra variables candidates in
Gaia DR2 and infer their variability parameters. BY Dra candidates are
pre-selected from their position in the HR diagram, built from Gaia parallaxes,
$G$ magnitudes, and $(G_{BP} - G_{RP})$ colours. Since the time evolution of
the stellar active region can disrupt the coherence of the signal, segments not
much longer than their expected evolution timescale are extracted from the
entire photometric time-series and period search algorithms are applied to each
segment. For the Gaia DR2, we select sources having similar period in at least
two segments as candidates BY Dra. Results are further filtered considering the
time series phase coverage and the expected approximate light curve shape. Gaia
DR2 includes rotational periods and modulation amplitudes of 147 535 BY Dra
candidates. The data unveil the existence of two populations with distinctive
period and amplitude distributions. The sample covers 38% of the whole sky when
divided in bins (HEALPix) of $\approx$0.84 square degrees and we estimate that
represents 0.7 -- 5 % of all BY Dra stars potentially detectable by Gaia. The
preliminary data contained in Gaia DR2 illustrate the vast and unique
information that the mission is going to provide on stellar rotation and
magnetic activity. This information, complemented by Gaia exquisite parallaxes,
proper motions, and astrophysical parameter, is opening new and unique
perspectives for our understanding of the evolution of stellar angular momentum
and dynamo action.
