The Marin County Fair is held every year in San Rafael over the Fourth of July weekend, and it's fun for the whole family. There's an amusement park with all kinds of rides, many of them suitable for small children; photography, arts & crafts, and magic shows; animal exhibits and demonstrations, e.g. mule driving, cow milking, llamas, potbellied pigs.
There are concerts with well-known names -- the 2006 lineup included The Preservation Hall Jazz Band, Rick Springfield, The Nelsons, Eddie Money, and Joan Jett. And of course, there are all kinds of food concessions stands. The fair always closes with fireworks over the lagoon.
It's a great deal, as the ticket for admission to the fair ($13 in 2006) also admits you to the concerts.