Keep inputs visible above the on-screen keyboard in the native shell.
The mobile shell does not resize your page when the keyboard opens; the keyboard is drawn over it. Moving your UI out of the way is up to you, and the shell tells you the keyboard’s height every time it opens or closes.
KeyboardAvoidingView
The web counterpart of React Native’s component.
import { KeyboardAvoidingView } from '@cskn/sdk';// 'padding' (default): grows bottom padding, so scrollable content can scroll above the keyboard<KeyboardAvoidingView style={{ height: '100%', overflowY: 'auto' }}> <Form /></KeyboardAvoidingView>// 'position': moves the element up, for bars pinned to the bottom<KeyboardAvoidingView behavior="position" offset={8} style={{ position: 'fixed', left: 0, right: 0, bottom: 0 }}> <ChatInput /></KeyboardAvoidingView>
'padding' | 'position'
default:"'padding'"
How to make room.
number
default:"0"
Extra gap above the keyboard, in px.
The transition follows the keyboard’s own animation duration. In a browser it renders a plain div.
height is in CSS pixels, and duration is the keyboard animation in milliseconds (250 when the shell does not send one). Without React: getKeyboardState() and onKeyboardChange(cb).@cskn/ui’s Screen also takes keyboardAvoiding, which pads the bottom of the screen by the keyboard height.
Don’t avoid the keyboard twice
Use the bridge’s keyboard height as your only source. 100vh never changes for the keyboard, and window.visualViewport behaves differently per platform: on iOS it shrinks by the keyboard height on its own; on Android it never changes. A layout sized to visualViewport.height that also pads by height makes room twice on iOS, leaving the input floating a keyboard’s height too high.
In a plain browser there is no bridge and no keyboard event, so visualViewport is the only signal. If you support both, stop following visualViewport while visible is true.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"cskn Developers","colors":{"primary":"#0E7490","light":"#22D3EE","dark":"#0E7490"},"logo":{"light":"https://mintcdn.com/cskn/nVnP1SM0RHDt2P4O/logo/light.svg?fit=max\u0026auto=format\u0026n=nVnP1SM0RHDt2P4O\u0026q=85\u0026s=c32921af2ea7b26ed147c2fc20b7ccee","dark":"https://mintcdn.com/cskn/nVnP1SM0RHDt2P4O/logo/dark.svg?fit=max\u0026auto=format\u0026n=nVnP1SM0RHDt2P4O\u0026q=85\u0026s=744e66e27e1cf87a23616f001cc434fe"},"favicon":"https://mintcdn.com/cskn/nVnP1SM0RHDt2P4O/favicon.svg?fit=max\u0026auto=format\u0026n=nVnP1SM0RHDt2P4O\u0026q=85\u0026s=3befee8751ab38dad2aa73683be379c7","navbar":{"primary":{"type":"button","label":"cskn.app","href":"https://cskn.app"}},"footer":{"socials":{"website":"https://cskn.app"}},"contextual":{"options":["copy","view"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"cskn","hasAudioNarration":false,"actualSubdomain":"cskn","customDomains":["docs.cskn.dev"],"gitSource":{"type":"github","owner":"cskndev","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":"","_id":"6b1101889ffae5051c41e0df"},"entitlements":{"AI_CHAT":{"status":"DISABLED"},"WEB_MCP":{"status":"DISABLED"},"NARRATION":{"status":"DISABLED"}},"buildId":"6b11d0585cba04131759e65f","clientVersion":"0.0.4458","searchFilterCounts":[{"language":"default","tag":"@cskn/sdk","count":36},{"language":"default","tag":"@cskn/ui","count":27},{"language":"default","tag":"Native features","count":20},{"language":"default","tag":"Platform API","count":10},{"language":"default","tag":"Get started","count":9},{"language":"default","tag":"Components","count":9},{"language":"default","tag":"Profile integration","count":7},{"language":"default","tag":"Overview","count":6},{"language":"default","tag":"Platform","count":5},{"language":"default","tag":"Stack navigation","count":5}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"sdk/native/keyboard","slug":"/sdk/native/keyboard","pageMetadata":{"title":"Keyboard","description":"Keep inputs visible above the on-screen keyboard in the native shell.","href":"/sdk/native/keyboard"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Keep inputs visible above the on-screen keyboard in the native shell.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,ParamField,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The mobile shell does `,_jsx(_components.strong,{children:`not`}),` resize your page when the keyboard opens; the keyboard is drawn over it. Moving your UI out of the way is up to you, and the shell tells you the keyboard’s height every time it opens or closes.`]}),`\n`,_jsx(Heading,{level:`2`,id:`keyboardavoidingview`,children:`KeyboardAvoidingView`}),`\n`,_jsx(_components.p,{children:`The web counterpart of React Native’s component.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`tsx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`tsx`,children:_jsxs(_components.code,{language:`tsx`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`KeyboardAvoidingView`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@cskn/sdk'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 'padding' (default): grows bottom padding, so scrollable content can scroll above the keyboard`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#4EC9B0`},children:`KeyboardAvoidingView`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` style`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`height:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '100%'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`overflowY:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'auto'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#4EC9B0`},children:`Form`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` />`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#4EC9B0`},children:`KeyboardAvoidingView`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 'position': moves the element up, for bars pinned to the bottom`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#4EC9B0`},children:`KeyboardAvoidingView`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` behavior`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"position\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` offset`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` style`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`position:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'fixed'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`left:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`right:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bottom:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#4EC9B0`},children:`ChatInput`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` />`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#4EC9B0`},children:`KeyboardAvoidingView`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`]})})}),`\n`,_jsx(ParamField,{path:`behavior`,type:`'padding' | 'position'`,default:`'padding'`,id:`param-behavior`,children:`How to make room.`}),`\n`,_jsx(ParamField,{path:`offset`,type:`number`,default:`0`,id:`param-offset`,children:`Extra gap above the keyboard, in px.`}),`\n`,_jsxs(_components.p,{children:[`The transition follows the keyboard’s own animation duration. In a browser it renders a plain `,_jsx(_components.code,{children:`div`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`usekeyboard`,children:`useKeyboard`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`tsx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`tsx`,children:_jsxs(_components.code,{language:`tsx`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`useKeyboard`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@cskn/sdk'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`visible`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`height`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`duration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` useKeyboard`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`height`}),` is in CSS pixels, and `,_jsx(_components.code,{children:`duration`}),` is the keyboard animation in milliseconds (250 when the shell does not send one). Without React: `,_jsx(_components.code,{children:`getKeyboardState()`}),` and `,_jsx(_components.code,{children:`onKeyboardChange(cb)`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`@cskn/ui’s `,_jsx(_components.code,{children:`Screen`}),` also takes `,_jsx(_components.code,{children:`keyboardAvoiding`}),`, which pads the bottom of the screen by the keyboard height.`]}),`\n`,_jsx(Heading,{level:`2`,id:`don’t-avoid-the-keyboard-twice`,children:`Don’t avoid the keyboard twice`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Use the bridge’s keyboard height as your `,_jsx(_components.strong,{children:`only`}),` source. `,_jsx(_components.code,{children:`100vh`}),` never changes for the keyboard, and `,_jsx(_components.code,{children:`window.visualViewport`}),` behaves differently per platform: on iOS it shrinks by the keyboard height on its own; on Android it never changes. A layout sized to `,_jsx(_components.code,{children:`visualViewport.height`}),` that also pads by `,_jsx(_components.code,{children:`height`}),` makes room twice on iOS, leaving the input floating a keyboard’s height too high.`]})}),`\n`,_jsxs(_components.p,{children:[`In a plain browser there is no bridge and no keyboard event, so `,_jsx(_components.code,{children:`visualViewport`}),` is the only signal. If you support both, stop following `,_jsx(_components.code,{children:`visualViewport`}),` while `,_jsx(_components.code,{children:`visible`}),` is `,_jsx(_components.code,{children:`true`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Keyboard","description":"Keep inputs visible above the on-screen keyboard in the native shell.","href":"/sdk/native/keyboard"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"KeyboardAvoidingView","slug":"keyboardavoidingview","depth":2,"children":[]},{"title":"useKeyboard","slug":"usekeyboard","depth":2,"children":[]},{"title":"Don’t avoid the keyboard twice","slug":"don’t-avoid-the-keyboard-twice","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"cskn","siteName":"cskn Developers","title":"Keyboard - cskn Developers","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-08T00:17:52.309Z","originalFileLocation":"sdk/native/keyboard.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Keep inputs visible above the on-screen keyboard in the native shell.\">\u003cmeta data-mint-head name=\"application-name\" content=\"cskn Developers\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cskn/J7DrGtll2kzPzkW6/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/cskn/J7DrGtll2kzPzkW6/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cskn/J7DrGtll2kzPzkW6/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/cskn/J7DrGtll2kzPzkW6/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/cskn/J7DrGtll2kzPzkW6/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cskn/J7DrGtll2kzPzkW6/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cskn/J7DrGtll2kzPzkW6/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/cskn/J7DrGtll2kzPzkW6/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/cskn/J7DrGtll2kzPzkW6/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Keyboard - cskn Developers\">\u003cmeta data-mint-head property=\"og:description\" content=\"Keep inputs visible above the on-screen keyboard in the native shell.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"cskn Developers\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.cskn.dev/sdk/native/keyboard\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://cskn.mintlify.site/_mintlify/api/og/v2?division=Native+features\u0026amp;title=Keyboard\u0026amp;description=Keep+inputs+visible+above+the+on-screen+keyboard+in+the+native+shell.\u0026amp;theme=6a82b949ac7d04df3dad9ac1\u0026amp;signature=1ffa079667c068a18b57fb57dd9df17a66d53759056a26cf8b83b1a33e783d0c\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Keyboard - cskn Developers\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Keep inputs visible above the on-screen keyboard in the native shell.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://cskn.mintlify.site/_mintlify/api/og/v2?division=Native+features\u0026amp;title=Keyboard\u0026amp;description=Keep+inputs+visible+above+the+on-screen+keyboard+in+the+native+shell.\u0026amp;theme=6a82b949ac7d04df3dad9ac1\u0026amp;signature=1ffa079667c068a18b57fb57dd9df17a66d53759056a26cf8b83b1a33e783d0c\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/cskn/J7DrGtll2kzPzkW6/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"cskn Developers\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0E7490\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.cskn.dev/sdk/native/keyboard\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdk/native/keyboard.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.cskn.dev/#organization\",\"name\":\"cskn Developers\",\"url\":\"https://docs.cskn.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/cskn/nVnP1SM0RHDt2P4O/logo/light.svg?fit=max\u0026auto=format\u0026n=nVnP1SM0RHDt2P4O\u0026q=85\u0026s=c32921af2ea7b26ed147c2fc20b7ccee\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.cskn.dev#website\",\"name\":\"cskn Developers\",\"url\":\"https://docs.cskn.dev\",\"publisher\":{\"@id\":\"https://docs.cskn.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.cskn.dev/sdk/native/keyboard#webpage\",\"url\":\"https://docs.cskn.dev/sdk/native/keyboard\",\"name\":\"Keyboard\",\"description\":\"Keep inputs visible above the on-screen keyboard in the native shell.\",\"dateModified\":\"2026-10-08T00:17:52.309Z\",\"isPartOf\":{\"@id\":\"https://docs.cskn.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.cskn.dev/sdk/native/keyboard#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.cskn.dev/sdk/native/keyboard#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Native features\",\"item\":\"https://docs.cskn.dev/sdk/native/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Keyboard\",\"item\":\"https://docs.cskn.dev/sdk/native/keyboard\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.cskn.dev/sdk/native/keyboard#article\",\"headline\":\"Keyboard\",\"name\":\"Keyboard\",\"description\":\"Keep inputs visible above the on-screen keyboard in the native shell.\",\"url\":\"https://docs.cskn.dev/sdk/native/keyboard\",\"mainEntityOfPage\":{\"@id\":\"https://docs.cskn.dev/sdk/native/keyboard#webpage\"},\"dateModified\":\"2026-10-08T00:17:52.309Z\",\"publisher\":{\"@id\":\"https://docs.cskn.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.cskn.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"cskn Developers\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"cskn Developers\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/sdk/native/keyboard.md","siteName":"cskn Developers","nav":{"global":null,"tabs":[{"tab":"Get started","pages":[{"title":"Get started","href":""}]},{"tab":"@cskn/sdk","groups":[{"group":"Overview","pages":[{"title":"@cskn/sdk","href":"/sdk/overview"}]},{"group":"Platform API","pages":[{"title":"API client","href":"/sdk/api-client"},{"title":"User profile","href":"/sdk/user"},{"title":"App data API","href":"/sdk/app-data"},{"title":"Follows","href":"/sdk/follow"},{"title":"AI credits","href":"/sdk/ai-credits"},{"title":"Quotas","href":"/sdk/quotas"},{"title":"Cross-app shares","href":"/sdk/cross-app"},{"title":"Offline queue","href":"/sdk/offline-queue"},{"title":"Image uploads","href":"/sdk/uploads"},{"title":"URLs and routing","href":"/sdk/urls"}]},{"group":"Native features","pages":[{"title":"Native features","href":"/sdk/native/overview"},{"title":"App control","href":"/sdk/native/app-control"},{"title":"System bars","href":"/sdk/native/system-bars"},{"title":"Camera","href":"/sdk/native/camera"},{"title":"QR scanner","href":"/sdk/native/qr-scanner"},{"title":"Video player","href":"/sdk/native/video-player"},{"title":"Image picker","href":"/sdk/native/image-picker"},{"title":"Clipboard","href":"/sdk/native/clipboard"},{"title":"Storage","href":"/sdk/native/storage"},{"title":"Notifications","href":"/sdk/native/notifications"},{"title":"Web Push","href":"/sdk/native/web-push"},{"title":"Share","href":"/sdk/native/share"},{"title":"Haptics","href":"/sdk/native/haptics"},{"title":"Biometrics","href":"/sdk/native/biometrics"},{"title":"Passkeys","description":"Passwordless sign-in and signing with WebAuthn, through one API on every surface.","href":"/sdk/native/passkeys"},{"title":"Keyboard","href":"/sdk/native/keyboard"},{"title":"Platform and language","description":"Which OS and host your app runs on, and the shell's UI language.","href":"/sdk/native/platform-language"},{"title":"Deep links","href":"/sdk/native/deep-links"},{"title":"System pickers and accent","href":"/sdk/native/system-pickers"},{"title":"App messages","href":"/sdk/native/app-messages"}]},{"group":"Profile integration","pages":[{"title":"Widgets","href":"/sdk/widgets"},{"title":"App settings","href":"/sdk/app-settings"},{"title":"Themes","href":"/sdk/themes"},{"title":"Platform menu","href":"/sdk/platform-menu"}]},{"group":"Reference","pages":[{"title":"Bridge protocol","href":"/sdk/bridge-protocol"}]}]},{"tab":"@cskn/ui","pages":[{"title":"@cskn/ui","href":"/ui/overview"}]}]},"basePath":"","title":"Keyboard - cskn Developers","deploymentId":"dpl_HZVV42MMRSo9WnNHfTGZvby5jph9","buildId":"dpl_HZVV42MMRSo9WnNHfTGZvby5jph9","dynamics":[],"chunks":[]}