
Capacitor Keyboard
- 585 installs
- 57 repo stars
- Updated July 13, 2026
- cap-go/capgo-skills
capacitor-keyboard is a Capacitor agent skill that manages keyboard visibility, accessory bars, scroll behavior, and input focus on iOS and Android for developers fixing hybrid mobile keyboard bugs.
About
capacitor-keyboard is a skill from cap-go/capgo-skills that documents correct keyboard handling in Capacitor hybrid apps on iOS and Android. It covers installing @capacitor/keyboard with npm and npx cap sync, then using the Keyboard plugin API for show and hide, keyboard event listeners, accessory bar configuration, and scroll adjustments when inputs focus. Developers reach for it when WebView layouts jump, inputs hide behind the keyboard, or accessory toolbars behave inconsistently across platforms. TypeScript examples import { Keyboard } from '@capacitor/keyboard' and demonstrate await Keyboard.show() plus event-driven layout fixes. The skill triggers on keyboard-related bug reports during mobile QA. It assumes an existing Capacitor project rather than greenfield native Swift or Kotlin development. Skip it for pure React Native or Flutter apps that do not use Capacitor's WebView bridge.
- Installs and configures the official @capacitor/keyboard plugin
- Handles keyboardWillShow, keyboardWillHide, and keyboardDidShow events
- Supports all four resize modes: body, ionic, native, and none
- Manages accessory bar, scroll adjustments, and input focus issues
- Provides ready-to-use TypeScript snippets for show, hide, and listeners
Capacitor Keyboard by the numbers
- 585 all-time installs (skills.sh)
- Ranked #285 of 1,039 Mobile Development skills by installs in the Skillselion catalog
- Data as of Aug 1, 2026 (Skillselion catalog sync)
npx skills add https://github.com/cap-go/capgo-skills --skill capacitor-keyboardAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 585 |
|---|---|
| repo stars | ★ 57 |
| Last updated | July 13, 2026 |
| Repository | cap-go/capgo-skills ↗ |
How do you handle keyboard behavior in Capacitor apps?
Correctly manage keyboard visibility, accessory bars, scroll behavior, and focus in Capacitor iOS and Android apps.
Who is it for?
Mobile developers building Capacitor hybrid apps who hit keyboard overlap, scroll jump, or focus bugs on iOS and Android.
Skip if: Native-only iOS/Android projects or React Native and Flutter apps that do not use the Capacitor Keyboard plugin.
When should I use this skill?
The user reports keyboard issues, wants keyboard events, needs to hide the keyboard, or has scroll problems when inputs focus in Capacitor.
What you get
Working @capacitor/keyboard integration, keyboard event handlers, scroll fixes, and accessory bar configuration for iOS and Android.
- Keyboard plugin integration code
- Event handlers and scroll fixes
Files
Keyboard Handling in Capacitor
Manage keyboard behavior in iOS and Android apps.
When to Use This Skill
- User has keyboard issues
- User needs keyboard events
- User wants to hide keyboard
- User has scroll issues with keyboard
- User wants keyboard accessory bar
Quick Start
npm install @capacitor/keyboard
npx cap syncBasic Usage
import { Keyboard } from '@capacitor/keyboard';
// Show keyboard
await Keyboard.show();
// Hide keyboard
await Keyboard.hide();
// Listen for keyboard events
Keyboard.addListener('keyboardWillShow', (info) => {
console.log('Keyboard height:', info.keyboardHeight);
});
Keyboard.addListener('keyboardWillHide', () => {
console.log('Keyboard hiding');
});Configuration
// capacitor.config.ts
plugins: {
Keyboard: {
resize: 'body', // 'body' | 'ionic' | 'native' | 'none'
style: 'dark', // 'dark' | 'light' | 'default'
resizeOnFullScreen: true,
},
},Resize Modes
| Mode | Description |
|---|---|
body | Resize body element |
ionic | Use Ionic's keyboard handling |
native | Native WebView resize |
none | No automatic resize |
Handle Keyboard Height
import { Keyboard } from '@capacitor/keyboard';
import { Capacitor } from '@capacitor/core';
if (Capacitor.isNativePlatform()) {
Keyboard.addListener('keyboardWillShow', (info) => {
document.body.style.setProperty(
'--keyboard-height',
`${info.keyboardHeight}px`
);
});
Keyboard.addListener('keyboardWillHide', () => {
document.body.style.setProperty('--keyboard-height', '0px');
});
}.chat-input {
position: fixed;
bottom: calc(var(--keyboard-height, 0px) + env(safe-area-inset-bottom));
left: 0;
right: 0;
}Scroll to Input
Keyboard.addListener('keyboardWillShow', async (info) => {
const activeElement = document.activeElement as HTMLElement;
if (activeElement) {
// Wait for keyboard animation
await new Promise((r) => setTimeout(r, 100));
activeElement.scrollIntoView({
behavior: 'smooth',
block: 'center',
});
}
});iOS Accessory Bar
// Show/hide the toolbar above keyboard
await Keyboard.setAccessoryBarVisible({ isVisible: true });Form Best Practices
// Prevent zoom on iOS (use font-size >= 16px)
input {
font-size: 16px;
}
// Handle form submission
form.addEventListener('submit', async (e) => {
e.preventDefault();
await Keyboard.hide();
// Process form
});
// Move to next field
input.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
const nextInput = getNextInput();
if (nextInput) {
nextInput.focus();
} else {
Keyboard.hide();
}
}
});Troubleshooting
| Issue | Solution |
|---|---|
| Content hidden | Use resize mode |
| Slow animation | Use keyboardWillShow |
| iOS zoom | Use 16px font-size |
| Android overlap | Set windowSoftInputMode |
Resources
- Capacitor Keyboard: https://capacitorjs.com/docs/apis/keyboard
{
"version": "1.0.0",
"organization": "Capgo",
"date": "January 2026",
"abstract": "Guide to handling keyboard in Capacitor apps including visibility detection, height management, accessory bar, and scroll behavior.",
"triggers": [
"keyboard",
"keyboard height",
"hide keyboard",
"keyboard overlap",
"input focus"
],
"references": [
"https://capacitorjs.com/docs/apis/keyboard"
]
}
Related skills
How it compares
Use capacitor-keyboard for Capacitor WebView apps; use platform-native keyboard guides for pure Swift or Kotlin projects.
FAQ
How do you install the Capacitor Keyboard plugin?
The capacitor-keyboard skill specifies npm install @capacitor/keyboard followed by npx cap sync. After sync, import { Keyboard } from '@capacitor/keyboard' in TypeScript to show, hide, and listen for keyboard events.
What keyboard problems does capacitor-keyboard solve?
capacitor-keyboard addresses visibility detection, accessory bar setup, scroll behavior when inputs focus, and programmatic keyboard show/hide in Capacitor hybrid apps on iOS and Android WebViews.