Disclosed are compounds of Formula (I):or a salt thereof, wherein: X is CR4 or N; R1, R2, R3, R4, and A are defined herein. Also disclosed are methods of using such compounds as inhibitors of Bruton's tyrosine kinase (Btk), and pharmaceutical compositions comprising such compounds. These compounds are useful in treating, preventing, or slowing the progression of diseases or disorders in a variety of therapeutic areas, such as autoimmune diseases and vascular disease.