Header
The Header component provides a navigation bar with logo, title, and action buttons.
Featuresβ
- π¨ Logo support
- π Title display
- π Left/right actions
- π Back button
- β Close button
- π Custom height
Basic Usageβ
import { Header } from '@tansuk/rott-ui';
<Header title="My Screen" />
With Logoβ
<Header height={40} logo="COMPANY_LOGO" />
With Actionsβ
<Header
title="Settings"
leftElement={<Icon name="MENU" width={24} height={24} />}
rightElement={<Icon name="SETTINGS" width={24} height={24} />}
/>
Multiple Iconsβ
<Header
title="Messages"
leftIcon={[
{ name: 'ARROW_LEFT', onPress: () => navigation.goBack() },
]}
rightIcon={[
{ name: 'SEARCH', onPress: () => {} },
{ name: 'MORE', onPress: () => {} },
]}
/>
Close Buttonβ
<Header
title="Modal Title"
closeButton
onClose={() => navigation.goBack()}
/>
Propsβ
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | - | Header title |
height | number | 56 | Header height |
logo | string | - | Logo name |
leftElement | ReactNode | - | Left element |
rightElement | ReactNode | - | Right element |
leftIcon | HeaderIconProps[] | - | Left icons |
rightIcon | HeaderIconProps[] | - | Right icons |
closeButton | boolean | false | Show close button |
Examplesβ
Navigation Headerβ
<Header
title="Home"
leftIcon={[{ name: 'MENU', onPress: () => navigation.openDrawer() }]}
rightIcon={[{ name: 'NOTIFICATION', onPress: () => {} }]}
/>
Modal Headerβ
<Header
title="Edit Profile"
closeButton
onClose={() => Modal.hideModal('edit-profile')}
rightIcon={[{ name: 'CHECK', onPress: handleSave }]}
/>