I use a Dakine hat. It does the job and is waterproof, reasonably comfortable too. There are others out there. Some use a plain old cap so it comes down to personal preference. I like the ones with a chin strap so it does not blow away. Some hats probably have zip pockets for keys wallett and phone, but do you really need it? I did hear of a guy whose hat blew off during a fast run. He turned downwind to retrieve it but failed to see the sandbank between him and the floating hat.
Surf hats with a stiff front brim and removeable legionnaires flap are very good. Dakine, O&E make them.

FCS do a good bucket hat with a stiff brim
if you prefer a cap, I got an Ocean and Earth mesh Truckers Surf cap, which has a strap. I've been happy with that too
I have a RipCurl bucket hat. It's much the same as the FCS, Indo, etc with a neoprene chin strap for stretchy comfort. I had to add a strap around the back of my head to stop it falling off whenever my head went under. A shoelace through the vent holes and over the top did the trick.
I liked and wore the FCS bucket hat for 4 seasons. I now wear the Garth helmet my wife bought me for Christmas.
A helmet that covers the ears and has a peak to shade the face.
.
Add a neck shade tail where nessasary, but is generally less needed as the back of the neck is generally shaded a bit by the body leaning back.
My biggest concern is is sun exposure on the ears, I've been surprised at the number of people I know who have had bits taken off them to remove spots that were turning nasty. As a result I wear a helmet that covers my ears almost all the time, although will wear a Tilley hat in light conditions. Tilley hat has a small amount of closed cell foam in the crown so will float if it comes off in a fall
Good point point Pacey. My ears are getting a bit munted, my cap's not the best for that. Might have to go back to the bucket hat. I removed the ear covers from my Gath as I didn't like the wind noise
Above 20 knots the front blows up. Below 20 it stays down.
The solution is to wear a rigid cap underneath and the windsurfing hat on top - perfect.
After 30years of windsurfing and a squamous cell carcinoma cut off from top of my head few years ago,
I always wear a helmet now. Besides the sun, it also keeps me warm in winter and offers protection from the
occasional knock from the mast. Now that I've started foiling, it's essential.
I never seem to find a helmet to fit my very narrow, long head. I'm just too perfect aerodynamically
.
Hats of all sorts tend to fly away in strong winds, so in light wind I wear an ordinary baseball cap and once it's blowing I swap it for a Gun Sails neoprene beanie, which has a cord to fix it to the wetsuit zipper. Generally it sits rather tight on a short crew cut, which I'm left with as the only possible option due to an extremely receding hairline
. It tends to fly off in forward loop rotations, though. Hence the cord comes in handy.
I have a Neil Pryde one I like I wear it for kids nippers Suping etc but windsurfing I wear a helmet. It has a neck flap that can be removed.
www.scboardsports.com.au/collections/hoods-surf-hats/products/2018-np-surf-bucket-hat