# Header Navigation header component with title, back button, and custom actions. ## Features - ✅ Optional back button with custom handler - ✅ Title display - ✅ Custom left/right content slots - ✅ Safe area support - ✅ Customizable colors and border - ✅ Press feedback on back button ## Installation ```bash npx @memoro/ui add header ``` **Dependencies:** text, icon ## Usage ### Basic Header ```tsx import { Header } from '@/components/navigation/Header';
; ``` ### With Back Button ```tsx import { useRouter } from 'expo-router'; function MyScreen() { const router = useRouter(); return
router.back()} />; } ``` ### With Custom Right Content ```tsx
{}} /> {}} /> } /> ``` ### With Custom Left Content ```tsx
} rightContent={ {}} />} /> ``` ### Without Border ```tsx
``` ### Without Safe Area ```tsx
``` ### Custom Colors ```tsx
``` ## Props | Prop | Type | Default | Description | | ----------------- | ------------ | ----------- | ------------------------------------------------------ | | `title` | `string` | - | Header title | | `showBackButton` | `boolean` | `false` | Show back button on the left | | `onBackPress` | `() => void` | - | Back button press handler (required if showBackButton) | | `leftContent` | `ReactNode` | - | Custom left content (overrides back button) | | `rightContent` | `ReactNode` | - | Custom right content | | `backgroundColor` | `string` | `'#FFFFFF'` | Background color | | `borderColor` | `string` | `'#E5E7EB'` | Border color | | `titleColor` | `string` | `'#111827'` | Title text color | | `backIconColor` | `string` | `'#3B82F6'` | Back button icon color | | `showBorder` | `boolean` | `true` | Show border at bottom | | `useSafeArea` | `boolean` | `true` | Use safe area insets for top padding | | `style` | `ViewStyle` | - | Additional styles | ## Default Styling - **Background:** White (#FFFFFF) - **Border:** Light gray (#E5E7EB) - **Title:** Dark gray (#111827), H4, Semibold - **Back Icon:** Blue (#3B82F6) - **Padding:** 16px horizontal, 12px vertical - **Min Height:** 56px ## Examples ### Profile Header ```tsx
router.back()}> } rightContent={ Save } /> ``` ### Search Header ```tsx
} rightContent={ Cancel } /> ``` ### Chat Header ```tsx
router.back()} leftContent={ {chat.name} } rightContent={ <> } /> ``` ### Settings Header ```tsx
router.back()} title="Settings" rightContent={} /> ``` ### Minimal Header ```tsx
``` ## Integration with Navigation ### Expo Router ```tsx import { Stack } from 'expo-router'; import { Header } from '@/components/navigation/Header'; export default function Layout() { return ( (
navigation.goBack()} /> ), }} /> ); } ``` ### React Navigation ```tsx import { Header } from '@/components/navigation/Header'; (
navigation.goBack()} /> ), }} > ; ``` ## Common Patterns ### Header with Multiple Actions ```tsx
} /> ``` ### Header with Badge ```tsx
{unreadCount > 0 && ( )} } /> ``` ### Transparent Header (Overlay) ```tsx
router.back()} backgroundColor="transparent" titleColor="#FFFFFF" backIconColor="#FFFFFF" showBorder={false} /> ``` ## Notes - Requires `react-native-safe-area-context` for safe area support - Back button is only shown if both `showBackButton={true}` and `onBackPress` are provided - `leftContent` overrides back button if provided - Minimum height is 56px to match standard header heights - Works on iOS, Android, and Web - Combine with HeaderButton component for consistent action buttons