Component
KeyboardAvoidingView
KeyboardAvoidingView handles application layouts outside Base UI drawers by exposing stable viewport and keyboard CSS variables.
Preview
Installation
pnpm dlx shadcn@latest add https://pwaui.com/r/keyboard-avoiding-view.jsonUsage
import { KeyboardAvoidingView } from "@/components/ui/keyboard-avoiding-view"
export function Composer() { return ( <KeyboardAvoidingView behavior="padding" keyboardOffset={8}> <textarea aria-label="Message" /> <button>Send</button> </KeyboardAvoidingView> )}Anatomy
KeyboardAvoidingViewuseVisualViewportBehavior notes
- Behaviors: padding, height, and position.
- Exposes --pwa-keyboard-height and --pwa-visual-viewport-height.
- Inside BottomSheet, prefer Base UI's dedicated keyboard provider.
Accessibility
The component is layout-only. Preserve normal focus order and label all form controls inside it.