RebodocsDocs
Start3
What is Rebodocs
Getting started
Demos to run
Put it in your app8
React component
Headless: your own UI
A complete interface
Without a framework
Only to read: the viewer
Styling and Tailwind
Phones and touch
Accessibility
Documents8
Templates and variables
On a server: DOCX and PDF
Documents in an S3 bucket
Letterheads
Versions
Tracked changes
Fonts
Languages
Together2
Real-time collaboration
AI assistants (MCP)
Reference5
Packages
Components and hooks
Editor API
How it works
Status and roadmap
↑↓ to move↵ to openEsc to close26 pages

Put it in your app Phones and touch

Phones and touch

A document does not change with the screen. Its pages are the same on a phone as on a monitor: the window is a place to look at them from, nearer or further, like a desk. What adapts is the zoom, the controls and the input.

tip: change the width below, and watch what the editor does with it
Live

At the width of a phone

The React component, as it comes: under 600 pixels it makes do with a narrow window by itself (features.responsive, on unless switched off).

Opening the editor…

Narrow

What a narrow window changes

Never the document: how it is shown, and what is around it.

Pages as wide as the window

Shown whole across it to begin with: a Letter page is at 46% on a phone 390 pixels wide. From there the zoom is the person’s.

Less room around them

From 24 pixels around and between the pages to 8: every pixel beside a page is one less of it.

No ruler

It is put away. The side panel opens over the document instead of making it narrower.

Bars that fold

The toolbar and the status bar put what does not fit in a menu, as they do at any width.

The zoom comes back

When the window is wide again, the pages go back to the zoom, or the fit, they had before.

Touch

Gestures

What a finger does on the pages. With a mouse, none of the handles or the bar below show.

Tap
Places the caret and brings up the keyboard. A handle stays under the caret for four seconds, to drag it exactly where it should be.
Tap on the caret
Again where the caret is, or on its handle: brings up the bar with Paste, Paste as text and Select all.
Double tap
Selects the word. A third tap, the paragraph.
Hold
Selects the word under the finger; without lifting it, the selection is drawn out.
Handles
One at each end of a selection. Dragged near the top or the bottom of the window, the document scrolls under them.
Swipe
Scrolls, without moving the caret.
Pinch
Zooms around the fingers: what is under them stays under them, and the two fingers carry the page as they go.
Bar

The bar for a finger

A selection made by touch brings up the bar beside it, which then also offers Copy, Cut, Paste, Paste as text and Select all: there are no keys for them. A tap on the caret brings it up with Paste and Select all, as a phone does.

It is the same bar a tap of ⌘ (Ctrl) brings up beside a selection with a keyboard, with what it offers for the text, the table or the picture selected. A touch anywhere else puts it away.

Paste needs HTTPS. It is only offered on a page served over HTTPS, or on localhost. Elsewhere the browser does not let a page read the clipboard; copying still works.

Keyboard

The keyboard of the screen

A phone does not make the window shorter when its keyboard comes up: it draws the keyboard over it.

The editor keeps the caret in what is left to be seen, and the interface that comes with it leaves the covered part empty, so its bars stay above the keyboard. Words appear as they are typed, also with a keyboard that composes them (every phone keyboard does), and change when the keyboard corrects the one being typed.

View

Reading view

The text set to the width of the window, with no pages, at its real size. It is never switched on by itself: some people prefer it to read or write at length on a phone.

It is the first of the views at the foot of the editor (the lines at the right of the status bar; in a narrow window, the only one left), and pressed again it goes back to the pages. Try it in the demo above. In code:

commands.setView('flow');     // and 'column' to go back to the pages

It is the same document, and exports the same file. Tables narrow to fit, as far as their columns can still be read; pictures shrink; what belongs to the page (header, footer, letterhead) is not shown there.

Your UI

In your own interface

With the headless hooks, useDocsResponsive fits the pages to the width, and says whether the window is narrow and how many pixels of it the keyboard covers.

function Shell() {
  const { narrow, keyboard } = useDocsResponsive(600);
  return (
    <div className="flex h-dvh flex-col" style={{ paddingBottom: keyboard }}>
      {!narrow && <Ruler />}
      <DocsSurface className="min-h-0 flex-1" />
    </div>
  );
}

state.touch is true from a touch of the screen until the mouse is used: there are then no keys to copy and paste with. Without React:

import { createResponsive, keyboardInset, onKeyboard } from '@rebodocs/editor';

const responsive = createResponsive(shell, editor);   // shell: what the editor and its bars are in
responsive.narrow;                                     // true under 600 pixels
const stop = onKeyboard(() => console.log(keyboardInset()));  // pixels the keyboard covers
Honest

What to know

  • It was checked in a phone emulated in Chrome, with real touch events, and tried on one real phone. On-screen keyboards differ (Gboard, iOS, Samsung): say what yours does.
  • No capital letter is put by itself at the start of a sentence, and the keyboard is asked not to correct: the field has autocapitalize and autocorrect off.
  • A keyboard that goes back and rewrites a word already written is not followed: the word being typed is.
  • Chinese and Japanese are typed with the keyboard that composes them (pinyin, kana): what is being composed shows in place, and the characters it ends in take its place.