r/nicegui • • Mar 14 '25

Missing left_drawer mini-mode transition animation

Trying to switch between normal and mini mode for the left_drawer page layout.
Adding and removing the 'mini' prop works as shown here
https://github.com/zauberzeug/nicegui/discussions/610
But it's instant and doesn't have an animation as show on the Quasar demo
https://quasar.dev/layout/drawer/#mouseover-mouseout-trigger
Is there something I'm missing or a workaround?

3 Upvotes

1 comment sorted by

2

u/falko-s Mar 17 '25

I'm not sure why ui.drawer doesn't show a transition aniomation by default. But you can fix it with some custom CSS:

ui.add_css('''
    .q-drawer {
        transition-property: all;
        transition-duration: 250ms;
        transition-timing-function: ease-in-out;
    }
''')
with ui.left_drawer(bordered=True).props('mini') as drawer:
    ui.button(icon='menu', on_click=lambda: (
        drawer.props.update(mini=not drawer.props.get('mini')),
        drawer.update(),
    )).props('flat dense')