husi-topbar

Implements capsule-style Compose topbars with Haze blur and scroll-driven tint behavior.

1.8k|107|Updated Dec 24, 2023
One-click install
npx skills add https://github.com/xchacha20-poly1305/husi --skill husi-topbar-xchacha20-poly1305
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: husi-topbar
Source: https://github.com/xchacha20-poly1305/husi/tree/main/.agents/skills/husi-topbar
Command: npx skills add https://github.com/xchacha20-poly1305/husi --skill husi-topbar-xchacha20-poly1305

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Husi replaces Material 3's default TopAppBar and AppBarWithSearch with in-house capsule components, and developers need consistent guidance to wire Haze blur, scroll behaviors, and window insets correctly when adding or editing screens in composeApp/. ## Core Features & Use Cases - Capsule Component System: Provides CapsuleTopBar, CapsuleSearchTopBar, CapsuleActionButton, and CapsuleHeader as drop-in replacements for Material 3 top bars with automatic title marquee and edge fading. - Two Layout Patterns: Pattern A places a bar directly above scrolling content; Pattern B wraps topbar plus tabs or search in a blurred CapsuleHeader whose tint lerps on scroll. - Haze Blur Wiring: Enforces the three-part pattern of rememberHazeState, hazeSource on the content slot, and passing hazeState to the bar, with opaque fallbacks for Android 11 and below. - Use Case: When adding a new settings screen with a LazyColumn, follow Pattern A to get a blurred capsule topbar where list content scrolls visibly underneath. ## Quick Start Ask the AI to add a new screen in composeApp with a capsule topbar following the husi-topbar patterns, including Haze blur wiring and scroll behavior.

Frequently Asked Questions about husi-topbar

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a blurred top app bar in Jetpack Compose with Haze?

Create a hazeState with rememberHazeState, apply Modifier.hazeSource(hazeState) to the Scaffold content slot, and pass hazeState to CapsuleTopBar. The content must scroll under the bar using contentPadding rather than Modifier padding.

How do I combine a topbar with tabs in Compose without hiding the blur?

Wrap the topbar and tab row in a CapsuleHeader with hazeState and scrollBehavior, and set the tab row's containerColor to Color.Transparent. The header blurs as one block and its tint animates with scroll position.

Why is my Compose topbar blur not showing?

Blur fails when hazeState is null, no hazeSource with the same state exists in the content slot, or content is placed with Modifier padding so nothing scrolls under the bar. Also verify hazeSource is not on an ancestor of the topbar.

Why does the header tint not change when scrolling in Compose?

The scrollBehavior was not passed into CapsuleTopBar or CapsuleSearchTopBar. Their internal SetHeightOffsetLimit sets state.heightOffsetLimit, which is required for overlappedFraction to become non-zero and drive the tint animation.

Does Haze blur work on older Android versions?

On Android 11 and below Haze draws only the fallback color effect. CapsuleDefaults.blurStyle sets an opaque container color as fallback so text stays readable; never build a custom blur style without a fallbackColorEffect.

When should I pass null hazeState to a Compose topbar?

Pass null only when nothing can scroll under the bar, such as content placed with Modifier padding or a bar in a plain Column above the content. The capsule then draws a plain surfaceContainer fill at 0.75 alpha with no blur.