Here is a cheat sheet of sorts showing the 4 principal chords you need to know with intervals of 3, 4, 5, and 7. These examples are centered around the note C but even when moved to another note, the relationships between the noteheads in the chords will be the same. Of course, the trickiest ones are the intervals of 3 and 4 that look alike but differ when crossing or not crossing a gap. And, it turns out the interval of 4 (an even number) is the only one that doesn't cross a gap among this set.
On the keyboard the corresponding C Major white key relationships are:
interval of 3 - adjacent white keys (skip 1 black key)
interval of 4 - white keys separated by 1 white key (skip 2 black keys)
interval of 5 - white keys separated by 2 white keys (skip 2 black keys)
interval of 7 - white keys separated by 3 white keys (skip 3 black keys)
While it is possible to learn every chord by memorization, you will not develop a good sense of generalization whereby knowing the rules you can recognize and play chords with ease. This will be especially valuable when you expand beyond the C Major scale and there are whole new sets of chords to learn.
******
playing triads (3-note chords)
With that said, there's more. If you are indeed playing only on the white keys, you will not be able to play all chords. For example, you can play C Major, C-E-G, but not D Major, D-F#-A, because F# is a black key. therefore, with the C Major scale, you are limited to the three note chords (or triads) C Major, F Major (F-A-C), and G Major (G-B-D). It turns out there are three Major chords in each of the 24 possible scales, but not the same set of chords (different roots). And FYI, the same is true for minor chords (3 per scale).
This occurs because the two notes span a gap in the black keys. While it's pretty easy to see this while staring at the keyboard, it's a different story when you are trying not to look at the keyboard and are focusing on the sheet music. WYSIWYP notation helps alleviate this by having the red and blue lines at the gaps. Think of the red line as sitting on top of the "crack" between the B and C keys (where there's no black key). A chord with its root below C and it's 2nd note on C or above is crossing the gap. A chord with a root of C does not cross this gap. The blue line works in the same way for the E - F gap.
So with these chords (image of two note chords), practice playing them without looking at the keyboard and being conscious of the gaps. That is to say, "Mind the gaps".