
Capacitor Keyboard
- 106 installs
- 57 repo stars
- Updated July 13, 2026
- cap-go/capacitor-skills
Handles keyboard behavior in Capacitor apps including visibility detection, accessory bar, scroll behavior, and input focus on iOS and Android.
About
Guides managing keyboard behavior in Capacitor apps using @capacitor/keyboard, covering events, accessory bar, and scroll handling. A developer uses it to fix keyboard visibility, focus, or scroll issues.
- Keyboard visibility events and accessory bar control
- Fixes scroll and input focus issues on iOS and Android
Capacitor Keyboard by the numbers
- 106 all-time installs (skills.sh)
- Ranked #557 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/capacitor-skills --skill capacitor-keyboardAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 106 |
|---|---|
| repo stars | ★ 57 |
| Last updated | July 13, 2026 |
| Repository | cap-go/capacitor-skills ↗ |
What it does
Handles keyboard behavior in Capacitor apps including visibility detection, accessory bar, scroll behavior, and input focus on iOS and Android.
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
Mobile Developmentfrontend