An aromatic compound is a cyclic compound that contains 4n+24n+2 electrons in a planar conjugated piπ system (n = 0, 1, 2, …n=0,1,2,…), meaning the electrons are delocalized throughout the molecule, promoting resonance stabilization.
The most common aromatic compounds contain benzene rings (n = 1n=1).

But any planar cyclic compound that contains 2, 6, or 10 piπ electrons is aromatic.
Examples are azulene, with 10 piπ electrons, and pyridine, thiophene, and imidazole, each with 6 piπ electrons---but only those electrons that are in the ring count as being delocalized.
![
)
In thiophene, one pair of sulfur's lone electrons resides in a pp orbital coplanar with the ring, protruding outwards, and is thus localized (if you consider those delocalized piπ electrons in the ring to be in p_zpz orbitals, then the coplanar electrons are in a pp orbital that lies on the xyxy-plane).
Similarly, pyridine's sp^2sp2-nitrogen's lone pair and imidazole's sp^3sp3-nitrogen's lone pair of electrons are also coplanar with the rest of the ring, on a pp orbital protruding outwards.
You can see this from pyridine's MO depiction, for example:
![
)