suiss/ui · Component
Header
A navigation bar with a back button, a centered title, actions and an optional large title that collapses on scroll.
Header is an open-source component from suiss/ui for React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.

Header is a 44-point bar that sorts its children into three slots: HeaderBack and leading HeaderActions on the start side, HeaderTitle in the center, and everything else on the end side. The side slots share the remaining width equally, so the title stays centered.
Installation
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy and paste the following code into
components/ui/header.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy and paste the following code into
components/ui/header.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy and paste the following code into
components/ui/header.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
Large title
A large title that collapses into the bar on scroll.
Create a scroll state with useHeaderScroll(), pass it to both Header and HeaderScrollView, and put a HeaderLargeTitle at the top of the scroll view. As the large title scrolls away, the small title fades in and a hairline appears under the bar. Pulling down stretches the large title slightly.

This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.
Large title with subtitle
A large title with a subtitle.

This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.
Compact with scroll
A compact title whose hairline appears on scroll.
Without a large title, you can still pass the same scroll to Header and HeaderScrollView to show the hairline once content scrolls under the bar.

This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.
Subtitle
A two-line title with a subtitle.
Both HeaderTitle and HeaderLargeTitle accept a subtitle. Plain strings are wrapped in Text and truncated to one line in the bar.

Leading actions
Actions on both sides of the title.
Set side="leading" on HeaderActions to place a group on the start side.

Back only
A long back label that truncates.

Accessibility
HeaderTitleand a stringHeaderLargeTitlehave theheadingrole.HeaderBackhas thebuttonrole and is labelled with its text, or "Back" when it has none.- Give icon-only actions an
accessibilityLabel.
API Reference
Header
Bar that lays out the back button, title and actions.
| Prop | Type | Default |
|---|---|---|
scroll | HeaderScroll | - |
Also accepts the props of ViewProps.
scroll takes the scroll state from useHeaderScroll(). Colors follow light and dark mode with the system appearance.
HeaderTitle
Centered title with optional subtitle.
| Prop | Type | Default |
|---|---|---|
subtitle | React.ReactNode | - |
Also accepts the props of ViewProps.
HeaderLargeTitle
Large title at the top of the scroll content.
| Prop | Type | Default |
|---|---|---|
subtitle | React.ReactNode | - |
Also accepts the props of ViewProps.
In right-to-left layouts the large title scales from the correct edge.
HeaderBack
Back button with a caret and optional label.
| Prop | Type | Default |
|---|---|---|
children | React.ReactNode | - |
Also accepts the props of React.ComponentProps<typeof Pressable>.
Pass a text label such as the previous screen's name as children, and wire onPress to your navigation. The button dims to opacity-80 while pressed, and the caret rotates in right-to-left layouts.
HeaderActions
Row of actions for either side.
| Prop | Type | Default |
|---|---|---|
side | "leading" | "trailing" | "trailing" |
Also accepts the props of ViewProps.
Group icon buttons in HeaderActions.
HeaderScrollView
Scroll view that drives the header animations.
| Prop | Type | Default |
|---|---|---|
scroll | HeaderScroll | Required |
Also accepts the props of ScrollViewProps.
Pass the same scroll state from useHeaderScroll() that the Header gets.
Header
Bar that lays out the back button, title and actions.
| Parameter | Type | Default |
|---|---|---|
title | () -> Title | - |
leading | () -> Leading | - |
trailing | () -> Trailing | - |
Overloads: init(title:leading:trailing:), init(title:trailing:), init(title:leading:), init(title:).
HeaderTitle
Centered title with optional subtitle.
| Parameter | Type | Default |
|---|---|---|
_ title | LocalizedStringKey | - |
subtitle | LocalizedStringKey? | nil |
verbatim | String | - |
Overloads: init(_:subtitle:), init(verbatim:subtitle:).
HeaderLargeTitle
Large title at the top of the scroll content.
| Parameter | Type | Default |
|---|---|---|
_ title | LocalizedStringKey | - |
subtitle | LocalizedStringKey? | nil |
verbatim | String | - |
Overloads: init(_:subtitle:), init(verbatim:subtitle:).
HeaderBack
Back button with a caret and optional label.
| Parameter | Type | Default |
|---|---|---|
_ label | LocalizedStringKey? | nil |
action | (() -> Void)? | nil |
verbatim | String | - |
Overloads: init(_:action:), init(verbatim:action:).
HeaderActions
Row of actions for either side.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
HeaderScrollView
Scroll view that drives the header animations.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
header | () -> HeaderContent | - |
HeaderActionsSide
Values: Leading, Trailing.
HeaderState
Takes no parameters.
| Property | Type |
|---|---|
collapsedFraction | Float |
nestedScrollConnection | NestedScrollConnection |
rememberHeaderState
Takes no parameters.
Returns HeaderState.
Header
Bar that lays out the back button, title and actions.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
state | HeaderState | rememberHeaderState() |
content | @Composable () -> Unit | - |
HeaderTitle
Centered title with optional subtitle.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
subtitle | String? | null |
HeaderLargeTitle
Large title at the top of the scroll content.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
subtitle | String? | null |
HeaderBack
Back button with a caret and optional label.
| Parameter | Type | Default |
|---|---|---|
onClick | () -> Unit | - |
modifier | Modifier | Modifier |
text | String? | "Back" |
contentDescription | String | text ?: "Back" |
HeaderActions
Row of actions for either side.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
side | HeaderActionsSide: Leading | Trailing | HeaderActionsSide.Trailing |
content | @Composable RowScope.() -> Unit | - |






