ListHeader
Section header component that provides visual separation and labeling for grouped settings. Features dynamic spacing based on position in the list and theme integration for consistent typography.
Quick Example
import { ListHeader } from "@ovok/native";
import React from "react";
const ListHeaderExample = () => {
return (
<ListHeader
label="Account Settings"
isFirst={false}
isLast={false}
testId="account-header"
/>
);
};
export default ListHeaderExample;
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
label | string | ✓ | - | Text content displayed as the section header |
isFirst | boolean | ✓ | - | Whether this is the first item in the list |
isLast | boolean | ✓ | - | Whether this is the last item in the list |
testId | string | - | - | Test identifier for automated testing |
Component Behavior
The ListHeader component:
- Dynamic Spacing: Adjusts padding based on position in the list
- Typography: Uses DMSans_700Bold font family for clear hierarchy
- Theme Integration: Respects theme spacing values for consistency
- Accessibility: Provides semantic structure for section grouping
Spacing Logic
The component applies different spacing based on position:
// Top padding: none for first item, theme.spacing(6) for others
paddingTop: !isFirst ? theme.spacing(6) : 0;
// Bottom padding: none for last item, theme.spacing(4) for others
paddingBottom: !isLast ? theme.spacing(4) : 0;
This creates proper visual separation between sections while avoiding unnecessary spacing at list boundaries.
Styling
Theme Colors Used
theme.spacing(6)- Top spacing between sections (24px by default)theme.spacing(4)- Bottom spacing after headers (16px by default)
Related Components
- SettingList - Container component that automatically renders ListHeaders
- SettingListItem - Setting items that appear under headers