Overview
TheHeader component provides a consistent header layout across the application. It displays the application logo with responsive behavior and accepts children for custom header content.
Props
Content to render in the header alongside the logo. Typically includes user controls, document title, collaborators, and action buttons.
Optional CSS classes to apply to the header. Merged with default header styles using
cn() utility.Features
- Responsive Logo: Shows full logo on desktop (md+), icon-only on mobile
- Flexible Layout: Accepts any children for custom header content
- Home Navigation: Logo links to homepage (’/’)
- Utility Styling: Uses className merging for easy customization
Usage Example
Basic Usage
With Custom Styling
In CollaborativeRoom
TypeScript Interface
Component Structure
Responsive Behavior
Desktop (md breakpoint and up)
- Shows full logo (120px x 32px)
- Logo container takes up flex-1 space
- Children render in remaining space
Mobile (below md breakpoint)
- Shows compact icon logo (32px x 32px)
- Icon has right margin (mr-2)
- Children render alongside icon
Styling
The component uses:- Base class:
.header- Applied by default - Custom classes: Passed via
classNameprop - Utility:
cn()function for class name merging
Example Custom Styles
Logo Assets
Required logo files:/assets/icons/logo.svg- Full logo for desktop/assets/icons/logo-icon.svg- Icon-only for mobile
Common Patterns
Document Header
Simple App Header
Accessibility
- Logo link includes descriptive alt text
- Clickable logo area provides navigation to home
- Semantic HTML structure with proper landmarks
Related Components
- CollaborativeRoom - Uses Header for document pages
- ActiveCollaborators - Often rendered as Header children
- ShareModal - Common Header child component