In general, no, you should try to avoid directly coupling your UI to a ViewModel. In practice, the VM must live somewhere within the Composition, but in that case it’s generally considered best practice to have 1 function which is the “stateless” version that accepts parameters of the relevant VM state properties and its callbacks, and a “stateful” version with accepts the ViewModel, collects the States from it, and forwards all that data into the “stateless” one.
See
this codelab for an example of this pattern. It uses the
GameScreen()
composable to pass in the VM, which does little more than connect the VM to the stateless
GameLayout()
.