Abstract We discuss Calabi–Yau and fractional Calabi–Yau semiorthogonal components of derived categories of coherent sheaves on smooth projective varieties. The main result is a general construction of a fractional Calabi–Yau category from a rectangular Lefschetz decomposition and a spherical functor. We give many examples of applications of this construction and discuss some general properties of Calabi–Yau categories.