I'm taking a beginner online piano class. When writing a song in 6/8 time for the piano, do all the notes in each measure both in the treble clef and bass clef have to add up to 6 beats and use eighth notes or combinations of note durations as long as it all equals to 6 beats in each measure?
In 6/8 time, the eighth note gets the beat, so you need an equivalent of 6 eighth notes in each measure, in both the treble and bass clefs.
6/8 is normally fast and "feels" like there are two beats per measure, so it is divided into two groups, each equivalent to three eighth notes. (It would be unusual to have three quarter notes in the measure, for example. It would more likely be written as a quarter note, eighth note tied to eighth note, quarter note to show the two distinct groupings.)
When writing for any instrument, or combination of instruments, the duration of the notes and rests on each stave must add up to the total duration specified in the time signature.
So, in your case of 6/8 time, the total duration in each bar/measure must be 6 8th notes (that could be taken up by 6 8ths, 2 dotted quarter notes, 1 dotted half note etc.)
The rules for writing for piano in this case are essentially the same as any other instrument, except that piano, while being only 1 instrument, takes up 2 staves.
Each stave must independently fit the time signature, you essentially think of each hand as a separate instrument if you like. So if only 1 hand is playing, the other stave needs rests to complete the bar.
The only exception is that sometimes, when the piano is doing nothing, you see rests written between the staves instead of duplicated on each stave, but this isn't universal and it's equally correct to write the rests on each stave.
I'll find some pictures of this for an example to add to this answer in a bit :)
Generally speaking though, you have to fill out the measures on both staves, not just 1.
Yes, that's what 6/8 time means. Each bar contains enough time for six 8th notes.
But that's a bit obvious. Maybe you've come across something like this, where a single voice uses both staves? That's allowed. The two staves are being treated as one big stave.
(BTW, 6/8 is two in a bar, with a dotted quarter beat. Not six. We count "One-and-a-Two-and-a", not "One-Two-Three-Four-Five-Six")
6/8 time will have 2 beats in a measure, each beat will have 3 8th notes length.
6/8,9/8,12/8 times are considered as compound meters and each beat will have 3 8th notes length, however this 3 8th notes can be written in different forms,
one dotted quarter note
or three 8th notes
or one quarter note and one 8th note
or one quarter note and 2 16th notes
This rule is applicable to all instruments and clefs.