I'm fairly new to react development, and I was experimenting a bit with tailwindcss. I'm trying to build a small example of a navbar for mobile, but the transition from the right isn't smooth.
I've looked forums, and other answers here, yet none of them work in my case.
This is the navbar component:
import {useState} from "react";
import {GiHamburgerMenu} from "react-icons/gi";
export const SideMenuBar = () => {
const [sidebar, setSidebar] = useState(false)
const showSideBar = () => setSidebar(!sidebar)
return (
<div className={'side_bar_menu'}>
<GiHamburgerMenu onClick={showSideBar}/>
{
sidebar ? <div className={'side_menu_data_items'}/> : null
}
</div>
)
}
The css configuration on tailwind:
theme: {
extend: {
fontSize: {
'mobile-title': '2.60rem'
},
colors: {
'dark-blue': '#0A0F2E',
'dark-blue-2': '#181c64',
'grey-blue': '#3c0e66',
'light-blue-purple': '#344ff0',
'dark-shade-blue-500': '#221C5D'
},
spacing: {
'720': '45rem',
'336': '21rem'
},
zIndex: {
'1': '1'
},
transitionProperty: {
'width': 'width'
}
},
},
Finally, the css classes that I'm using on the navbar component.
.side_menu_data_items {
@apply bg-dark-blue-2 left-0 top-0 w-screen absolute -z-1 h-screen transition-width ease-in-out duration-500
}
Any idea on what I'm doing wrong or a hint is greatly appreciated.


-z-1toz-10and you need to have relative as a parent for this to work.