Trovella Wiki

Layout & Navigation

Responsive breakpoint strategy, five-zone sidebar, command palette, workspace switcher, and the structural decisions shaping how users move through Trovella.

Layout and navigation are the structural decisions that shape how users perceive and move through the product. Where Component Patterns documents the dashboard shell implementation, this page documents the reasoning behind the layout decisions.

Design-First Philosophy: Desktop-First Design, Mobile-First CSS

These sound contradictory but they address independent dimensions:

  • Design priority is desktop. B2B SaaS receives 65-74% desktop traffic (71% during business hours). The desktop experience is where users perform primary work -- dashboards, data tables, complex research workflows. Design this first.
  • CSS authoring direction is mobile-first. Tailwind CSS uses min-width breakpoints: unprefixed classes apply to all sizes, prefixed classes (md:, lg:) add complexity upward. This produces cleaner, more maintainable code.

In practice: think about the desktop layout first, then simplify it systematically for smaller screens. Write the CSS starting from the simplified mobile layout and building up.

Four-Breakpoint System

BreakpointPrefixWidthWhat changes
Base(none)0-639pxSingle column, off-canvas nav drawer, stacked widgets, card view for tables
smsm:640px+Minor layout tweaks: two-column stat grids, paired form fields
mdmd:768px+First major transition: collapsed sidebar visible (64px, icons only), two-column content
lglg:1024px+Second major transition: sidebar expands (240px with labels), 2-3 column dashboard grids
xlxl:1280px+Content reaches max-width (1200-1400px), refinements only

The 2xl breakpoint (1536px) is intentionally omitted. It can be added later if analytics show significant ultra-wide usage.

Three-State Sidebar

The sidebar is the primary navigation mechanism. Its responsive behavior is the most visible layout decision in the product.

StateViewportWidthBehavior
Expandedlg+ (1024px+)240pxIcon + text labels, section headers, workspace switcher. User can manually collapse (persists via cookie).
Collapsedmd-lg (768-1023px)64pxIcons only, tooltips on hover. Navigation without consuming content space.
Off-canvasBelow md (< 768px)HiddenHamburger icon triggers a drawer overlay with backdrop. Closes on navigation or backdrop tap.

Implemented via shadcn/ui's Sidebar component with collapsible="icon". The useSidebar hook provides programmatic control. Toggle shortcut: Cmd+B / Ctrl+B.

Content Area Math

ViewportSidebarContent widthAssessment
1280px (xl)240px expanded1040pxExcellent -- full dashboard
1024px (lg)240px expanded784pxGood -- two-column dashboard
768px (md)64px collapsed704pxGood -- two-column content
375px (base)0px hidden375pxMinimum -- single column

The sidebar is organized into five zones from top to bottom:

+-------------------------+
|  Workspace Switcher     |  Zone 1: Tenant context (name + avatar)
+-------------------------+
|  Search / Cmd+K         |  Zone 2: Quick access (command palette trigger)
+-------------------------+
|  > Dashboard            |
|  > [Core Feature]       |  Zone 3: Primary navigation (accordion sections)
|  > [Feature Group]      |
+-------------------------+
|  > Settings             |  Zone 4: Configuration (role-filtered)
|  > Admin (role-gated)   |
+-------------------------+
|  User Profile           |  Zone 5: Account (avatar + name + sign out)
+-------------------------+

Design Principles

  • Background slightly dimmer than main content -- navigation recedes, content takes focus.
  • Active item -- subtle background highlight + primary color text + filled icon variant.
  • Hover -- light background tint, 150ms transition.
  • Sidebar toggle -- Cmd+B / Ctrl+B, persists via cookies.

Accordion Grouping for Scalability

Navigation grows with the product. Accordion groups keep it manageable:

  • At launch (8-12 items): flat list with one or two collapsible groups.
  • At growth (15-25 items): 5-7 top-level groups, each containing 3-8 items. Active item's parent group auto-expands on page load.
  • Collapsed sidebar shows only top-level group icons -- clicking temporarily expands a floating panel with sub-items.

Role-Based Filtering

Navigation items are conditionally rendered based on the user's role in the current tenant. This is a security requirement -- never show nav items that produce permission errors when clicked.

RoleVisible sections
Admin/OwnerAll sections including Team Management, Billing, API Keys
MemberAll feature sections, personal Settings, no Admin sections
ViewerRead-only feature sections, personal Settings only
GuestLimited feature access as defined by invitation scope

Command Palette (Cmd+K)

A power-user navigation accelerator using shadcn/ui's Command component (built on cmdk). Three functions:

  1. Speed -- type "billing" faster than clicking through Settings > Billing.
  2. Feature discovery -- new users search for capabilities and find them (or learn they don't exist).
  3. Action execution -- trigger actions from anywhere: "Create new project," "Switch to dark mode."

Phased Content

CategoryItemsPhase
NavigationAll sidebar routesMVP
Quick actionsCreate, invite, exportMVP
SettingsTheme, notifications, profileMVP
Recent itemsLast 10 visited pagesPost-launch
Entity searchProjects, users, documents (API, debounced)Post-launch
Context actionsActions available on current pageGrowth

Visual Design

Centered modal overlay with backdrop blur, search input at top, grouped results with section headers. Width 640px on desktop, full-width on mobile. Open/close animation: scale 95% to 100% + fade (150ms).

Workspace Switcher

At the top of the sidebar (Zone 1). Shows current workspace name and avatar. Dropdown to switch between workspaces -- personal, family, and company accounts as defined by the three-tier tenant model.

The switcher must:

  • Show all workspaces the user belongs to
  • Indicate the current workspace clearly
  • Switch context immediately (navigation items, data, and permissions update)
  • Be accessible from the command palette ("Switch to [workspace name]")

Layout Patterns by View Type

These patterns guide how each type of screen is structured responsively:

View typeDesktop (lg+)Tablet (md)Mobile
Dashboard3-4 column stat grid, 2-column charts, full-width table2-column stats, charts stackSingle column throughout
List viewsFull data table, inline actions, filter barReduced columns, collapsed filtersCard layout (each row becomes a card)
Detail viewsTwo-column: main (60-70%) + metadata sidebar (30-40%)Narrower metadata panelSingle column, metadata stacked below
SettingsLeft nav sidebar (200px) + content (max-width 600-800px)Nav collapses to top tabsCategory list > dedicated pages
FormsTwo-column for paired fields, max-width 600-800pxSame or slightly narrowerSingle column, all fields stacked
Empty statesCentered, max-w-mdSameSame -- only sizing scales

Keyboard Navigation and Accessibility

Non-negotiable requirements (European Accessibility Act effective June 2025, WCAG 2.2 Level AA):

  • Skip link -- every page has "Skip to main content" as the first focusable element, visually hidden until keyboard focus.
  • Focus order -- tab order follows visual flow. Never use tabindex values greater than 0.
  • Modal focus trap -- when a modal/dialog/drawer opens, focus moves inside and cycles within it. Focus returns to the trigger on close.
  • Route change focus -- navigating to a new page moves focus to the page heading or <main>.
  • Focus-visible styling -- custom branded focus indicator using :focus-visible, showing the ring only for keyboard navigation.

Launch Keyboard Shortcuts

ShortcutAction
Cmd+K / Ctrl+KOpen command palette
Cmd+B / Ctrl+BToggle sidebar
EscapeClose modal/dialog/command palette
Tab / Shift+TabMove focus forward/backward
Enter / SpaceActivate focused element
Arrow keysNavigate within menus, tabs, lists

Container Queries vs. Media Queries

  • Media queries (Tailwind responsive prefixes) -- for page-level decisions: sidebar visibility, column counts, global spacing.
  • Container queries (Tailwind @container + @md:, @lg:) -- for reusable components that appear in contexts of varying width: dashboard widgets, cards in narrow or wide columns.

Container queries are first-class in Tailwind v4 (no plugins). This is critical for dashboard widgets -- a stat card should show a compact layout in a narrow column and an expanded layout in a wide column, regardless of viewport size.

What Can Wait

  • Customizable sidebar (pin, reorder, hide items) -- explicitly a $200K+ MRR feature. Deferred.
  • Bottom tab bar for mobile web -- only if analytics show >30% mobile product usage after launch.
  • Page navigation transitions -- instant navigation at MVP; animation added post-launch if desired.

On this page