Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
description: >- Learn how to build a responsive navigation menu with desktop links and a mobile hamburger menu using Webstudio.
How to Create a Responsive Navigation Menu
This guide walks you through creating a navigation menu that displays horizontal links on desktop and a hamburger menu (slide-out drawer) on mobile.
{% embed url="https://www.youtube.com/watch?v=81whpqLzuPw" %}
Overview
The final navigation will include:
- Desktop: Logo + horizontal navigation links
- Mobile: Logo + hamburger icon that opens a slide-out menu
- Synced content: Using Slots to keep menu items in sync between both views
Building the Desktop Menu
1. Create the Menu Structure
- Add a Box component and name it "Menu" in the Navigator
- Inside Menu, add another Box named "Menu Wrapper"
- Set Menu Wrapper to
display: flexwithjustify-content: space-between - Set a
max-width(e.g., 1200px) andmargin: 0 autofor centering
2. Add the Logo
- Inside Menu Wrapper, add a Link component
- Inside the Link, add an Image component for your logo
- Set the Link's href to
/(home page) - Style the image (e.g.,
height: 40px,width: auto)
3. Add Navigation Links
- Add a Box named "Desktop Links" next to the logo Link
- Set it to
display: flexwithgapfor spacing - Add Link components for each menu item
- Create a Token for link styling (color, font, hover effects)
4. Style Hover Effects
- Select a navigation link
- Create a Token named "nav-link"
- Add styles: color, text-decoration
- Switch to Hover state
- Add hover styles (e.g., color change, underline)
- Switch back to default state
- Add
transition: color 0.2s ease
Building the Mobile Menu
1. Add the Sheet Component
The Sheet component (from Radix) provides a pre-built slide-out menu:
- From Components, add a Sheet (under Radix)
- The Sheet includes: Trigger, Overlay, Content, Close, Title, Description
2. Configure the Sheet Trigger
- Select the Sheet Trigger
- Delete the default button text
- Add an Icon or SVG hamburger icon inside the Trigger
- Style the trigger (remove default button styles if needed)
3. Style the Sheet Content
- Select Sheet Content
- Position it: For a right-side drawer, use the anchor property
- Set
width(e.g., 300px or 80vw) - Add background color and padding
- Set
height: 100vhfor full-height drawer
4. Add Mobile Navigation Links
- Inside Sheet Content, add a Box for mobile links
- Set
display: flex,flex-direction: column - Add navigation links (we'll sync these with desktop using Slots)
Syncing Menus with Slots
Use Slots to maintain a single source of truth for menu items:
1. Create the Slot
- Select your Desktop Links container
- Copy it (Cmd/Ctrl + C)
- From Components, add a Slot component where your mobile links should be
- Paste the copied content into the Slot
Now both desktop and mobile menus share the same links. Edit once, update everywhere.
2. Adjust Slot Styling Per Location
The Slot inherits styles, but you can override them:
- Desktop:
flex-direction: row - Mobile (inside Sheet):
flex-direction: column
Apply these overrides using Local styles on the parent containers, not the Slot itself.
Making It Responsive
Hide/Show Based on Breakpoint
Select "Desktop Links" container
On mobile breakpoint:
display: noneSelect the Sheet Trigger
On Base breakpoint:
display: noneOn mobile breakpoint:
display: flex
This shows desktop links on large screens and the hamburger menu on mobile.
Tips and Best Practices
Auto-margin Positioning
To position the Sheet Trigger on the right:
margin-left: auto;
This pushes it to the far right within a flex container.
Close Menu on Link Click
For single-page sites with anchor links, you may want the menu to close when a link is clicked. This requires adding a small script or using Sheet's built-in close behavior.
Accessibility
- The Sheet component includes proper ARIA attributes
- Test keyboard navigation (Tab, Enter, Escape)
- Ensure sufficient color contrast
Z-Index Management
If menu dropdowns appear behind other content:
- Set
position: relativeon the menu container - Add
z-index: 100(or higher as needed)
Related Resources
- Sheet Component
- Slot Component
- Navigation Menu - For mega menu dropdowns
- Responsive design