bar-menu

A button on the system bar that is a menu. Press it and a short list opens under the bar; pick one and the list closes. It is the select you would put in a panel, one press shorter, and the same flat and in a headset. The camera mode of inspect-view uses one to pick its view: viewMenu(inspect).

import { b3d, barMenu, b3dLight, b3dGround } from 'tosijs-3d'

const weather = barMenu({
  icon: 'sun',
  title: 'Weather',
  options: ['clear', 'cloudy', 'storm'],
  value: 'clear',
  handleChange: (v) => console.log(v),
})
preview.append(
  b3d(
    {},
    b3dLight({ intensity: 1 }),
    b3dGround({ width: 20, height: 20, texture: 'checker', textureTiles: 10 }),
    weather
  )
)
tosi-b3d { width: 100%; height: 100%; }

It returns the <tosi-b3d-panel>: put it in the scene to show the button, take it out to hide it. menu.value reads or sets the choice (the list marks it).