There is a large variety of examples, see for instance
https://jsdokken.com/dolfinx-tutorial/chapter2/ns_code2.html#boundary-conditions
and there are plenty of posts on the forum about this, for instance Time-stepping of nonlinear time dependent problem with time-dependent BC - #8 by francesco-ballarin
Please note that your question is off-topic to the initial question, and should first warrant a search of the vast amount of posts on this forum to check if it has been asked before. I’ll be nice this time, and answer it fully, but if this behavior is repeated the post will be removed.