Header

Header component with title, back button, and actions

Header component for displaying page titles, navigation, and action buttons. Includes back button, avatar support, and action menu.

Basic Usage#

Interactive Preview
9:41

Home Screen

Page Content Placeholder

Props#

PropTypeDefaultRequiredDescription
titlestringHeader title text
showBackbooleanfalseShow back button
onBackPress() => voidBack button callback
backIconReactNodeCustom back icon
avatarReactNodeAvatar/image element
titlePosition'left' | 'center' | 'right''left'Title alignment
actionsHeaderAction[]Action buttons array
backgroundColorstringCustom header background color
borderColorstringCustom bottom border color
backButtonBackgroundColorstringBackground of the back button
backIconColorstringColor of the back icon
actionIconColorstringColor of action icons
styleViewStyleMain container styles
titleStyleTextStyleTitle text styles
backButtonStyleViewStyleBack button container styles

HeaderAction#

PropTypeDefaultRequiredDescription
iconReactNodeAction icon
onPress() => voidAction callback
badgenumber | stringBadge number/text

Examples#

With Back Button#

<Header
  title="Details"
  showBack={true}
  onBackPress={() => navigation.goBack()}
/>

With Actions#

import { MoreVertical, Share } from 'lucide-react-native'

<Header
  title="Post"
  showBack={true}
  onBackPress={() => {}}
  actions={[
    {
      icon: <Share size={20} />,
      onPress: () => console.log('Share'),
    },
    {
      icon: <MoreVertical size={20} />,
      onPress: () => console.log('More'),
    },
  ]}
/>

With Avatar and Centered Title#

<Header
  title="Profile"
  titlePosition="center"
  avatar={<Image source={require('./avatar.png')} />}
  actions={[
    {
      icon: <Settings size={20} />,
      onPress: () => {},
    },
  ]}
/>

With Badge#

<Header
  title="Messages"
  actions={[
    {
      icon: <Bell size={20} />,
      badge: '5',
      onPress: () => {},
    },
  ]}
/>

Custom Back Icon#

import { X } from 'lucide-react-native'

<Header
  title="Modal"
  showBack={true}
  backIcon={<X size={24} />}
  onBackPress={() => {}}
/>