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

import { Header } from 'prizmux'
import { ArrowLeft } from 'lucide-react-native'

export default function App() {
  return (
    <Header
      title="Page Title"
      onBackPress={() => navigation.goBack()}
    />
  )
}

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

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={() => {}}
/>