BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/motiq/keyboard-safe-form

Keyboard-safe Form

motiq/keyboard-safe-form
FreeComponent

A presentation-only mobile form whose sticky Submit/Cancel bar rides above the virtual keyboard via the VisualViewport API (degrading gracefully to a plain sticky footer where unavailable), with an aria-linked validation summary, cancellable async submission, and an unsaved-changes discard guard. The app owns the fields and submission.

Live preview

live · rendered by the registry
Rendered by motiq on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://www.motiq.dev/r/keyboard-safe-form.json

Source

registry/mobile/keyboard-safe-form.tsxwww.motiq.dev/r/keyboard-safe-form.json · first 6 KB
1"use client";
2
3/**
4 * KeyboardSafeForm — a mobile form that stays usable while the on-screen
5 * keyboard is open, and behaves like an ordinary form everywhere else.
6 *
7 * The hard part on mobile is that opening the virtual keyboard shrinks the
8 * *visual* viewport without shrinking the *layout* viewport, so a normal
9 * `position: fixed`/sticky footer ends up hidden behind the keyboard. This
10 * component solves that with the **VisualViewport API when it exists** and
11 * **degrades to a plain sticky footer when it doesn't** — it never depends on
12 * an unsupported "virtual keyboard" API. When the keyboard overlaps the layout
13 * viewport, the sticky action bar is lifted by exactly that overlap so Submit /
14 * Cancel stay reachable, and the focused field is scrolled into view.
15 *
16 * It is presentation-only: the **app owns the fields and the submit work**
17 * (passed as `children` + an `onSubmit` that returns a promise). The component
18 * owns the *scaffolding* production forms always need:
19 *
20 * - A validation summary (`errors`, or an inline `onValidate` on submit) that
21 * lists every error and links each one to its field by `fieldId`; activating
22 * an item moves focus to that field. Submit is blocked while errors remain.
23 * - Async submission via `useAsyncStatus`: idle → pending → success | error,
24 * with a cancellable in-flight state, a retry on failure, and a polite live
25 * region. Status is conveyed with icon + text, never colour alone.
26 * - An unsaved-changes guard: when `dirty`, cancelling (or leaving the page)
27 * asks before discarding.
28 *
29 * Accessibility & safety: labelled action buttons, `aria-live` status, focus
30 * moved to the summary on invalid submit and restored after the discard dialog,
31 * ≥44px targets, safe-area insets, 200%-zoom-safe layout, and a reduced-motion
32 * path that drops every transition while keeping the exact same behaviour.
33 * Clean-room original.
34 */
35
36import * as React from "react";
37import { motion, AnimatePresence } from "motion/react";
38
39import { cn } from "@/lib/utils";
40import { useReducedMotion, useAsyncStatus } from "@/lib/motiq";
41
42/* -------------------------------------------------------------------------- */
43/* Types */
44/* -------------------------------------------------------------------------- */
45
46export interface FieldError {
47 /** `id` of the field this error refers to — must match the input's `id`. */
48 fieldId: string;
49// … truncated

What it pulls in

npm packages

  • motion

Other registry items

  • https://motiq.dev/r/utils.json
  • https://motiq.dev/r/primitives.json

Files it writes

  • registry/mobile/keyboard-safe-form.tsx

Facts

Registry
motiq
Type
registry:component
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-12
Last confirmed
yesterday

Go to the source

Docs on motiq www.motiq.dev RMahammad/motiq on GitHub Raw registry item This item as JSON

More from motiq

All 100 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Activity Streamactivity-streammotiqComponentsFree1 dep
Adaptive Safe-Zone Gridadaptive-safe-zone-gridmotiqComponentsFreeno deps
Agent Run Timelineagent-run-timelinemotiqComponentsFree1 dep
AI Response Streamai-response-streammotiqComponentsFree1 dep
Animated Accordionanimated-accordionmotiqComponentsFree2 deps
Animated Buttonanimated-buttonmotiqComponentsFree1 dep
Animated Dialoganimated-dialogmotiqComponentsFree2 deps
Animated Gridanimated-gridmotiqComponentsFree2 deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex