When I was using this feature from the Bootstrap 4 I found an annoying effect with the collapsing examples on the docs.
The desirable behaviour was: - My toggle button on the right side (when xs size) - My menu on the right (when sm and up) - My collapsed menu on the left (when xs size)
Finally I came to this solution:
There is a gist for this code on: Gist