Skip to content
CrossFly is 100% open sourceFollow us on GitHub
CrossFlyCrossFly
Get started
Examples

Thirty-eight screens you can run right here

Four complete apps and thirty-four recipes, each running in your browser from the same Java that ships to Android, iOS, desktop (Windows, macOS and Linux) and the web. Read the source beside it, copy it, and keep going.

4
example apps
34
recipes
4
platforms, one codebase

Running here

Compiled to WebAssembly-era JavaScript by TeaVM — the same code, not a video of it.

WindowGridLayoutSkinSqliteDbTeaVM
Running hereCrossFly 0.1.32
Starting the app…

Compiled to WebAssembly-era JavaScript by TeaVM — the same code, not a video of it.

Topics
Recipes93 lines
Layouts

Any Component becomes a container with setLayout. The same three labels, three ways.

Layout
Recipes65 lines
Theme tokens

Flip the switch. The token line follows the theme; the hardcoded one does not, and turns unreadable — no rebuild involved.

Theming
Recipes76 lines
Switching skins

Shape, radius, padding and typeface all come from the skin. Nothing below knows which one is in force.

Theming
Recipes71 lines
Bottom sheet with a fixed footer

BottomSheet already gives you the header, the grabber, the close button and a footer that floats over the scroll. You only fill body().

NavigationOverlays
Recipes113 lines
Listing: cards or table

A card answers "what is this one?"; a row answers "how do these compare?". Which one the reader needs changes during the day, so Listing lets them switch.

Lists
Recipes81 lines
Choosing from a list

ListViewWindow does single and multi selection, with the title, the confirm and the tap-to-choose already wired.

ListsInput
Recipes123 lines
Picking a date range

DatePicker answers "which day". This answers "between which two", which has its own rules — and its own ways of being wrong.

Input
Recipes65 lines
Reordering a list

The first row has no up arrow and the last has no down arrow — hidden, not removed, so the column does not jitter as rows move.

Lists
Recipes77 lines
Making a screen testable

Tag anything a test must reach. Text breaks on rewording, class breaks on a second instance, index breaks on insertion — a tag breaks only when someone removes it.

Testing
Recipes84 lines
A form that fights back

setMode does most of the work: it picks the keyboard, the mask and the validation together. A regex on the way out only tells the user they already got it wrong.

FormsInput
Recipes97 lines
Telling the user something

Interrupt in proportion to what you need back. A confirmation on something reversible teaches people to dismiss confirmations — including the one that mattered.

Feedback
Recipes65 lines
Bottom nav that becomes a rail

One flag — tabsAtBottom — and the strip is a bottom bar on a phone and a rail on a tablet. Resize the window to see it happen.

NavigationLayout
Recipes131 lines
Waiting

Known length gets a bar. Unknown gets a spinner. A finished measurement — a share, a score — gets a ring, and that one is not waiting at all.

Feedback
Recipes80 lines
Cards that reflow

Tell CardGrid the width a card wants, not how many columns to use. Resize the window — the reflow is the framework's, not yours.

Layout
Recipes97 lines
A header that collapses

header() scrolls away, pinned() never does. Put the identity in the first and the control the reader needs at row 200 in the second.

LayoutLists
Recipes102 lines
Charts

autoThemeColors themes the axes, grid and background — but NOT the series. A series left at colour 0 falls back to a library grey, and becomes the one thing on screen ignoring your brand.

Charts
Recipes110 lines
A list too big to build

createView is rare, bindView is constant. Anything slow in bindView — a query, a request, an allocation — is felt directly as stutter while scrolling.

ListsPerformance
Recipes154 lines
Storing something

Add a few notes and reopen the recipe — they are still there. The same code runs on desktop, Android, iOS and the web.

Data
Recipes188 lines
Capturing a signature

White pad, not the theme surface: the image is captured to be printed. Under dark mode a themed pad captures white ink on navy, which is unusable downstream.

InputDrawing
Recipes84 lines
Pickers

show(answer -> …) on all of them, and answer is null when the user backed out. The ones needing hardware live in R21, and the system file picker in R31 — those can be refused.

Input
Recipes244 lines
Camera, barcode and GPS

Ask whether the device HAS it before offering it. PlatformUtils.isSupported answers per capability, at runtime — never a check on which platform this is.

Device
Recipes162 lines
Animation

Styles.animationDuration is the house value — match it, so the app moves at one speed. Anything the user waits through twice was too long the first time.

Animation
Recipes119 lines
Painting your own

A component is a rectangle that can draw. width/height are yours, getAutoHeight says how much room you want, and onPaint puts something in it.

Drawing
Recipes90 lines
Floating action button

It floats over the content, so leave room at the bottom of the list — bottomInset is what stops it covering the last row nobody can then scroll past.

Navigation
Recipes124 lines
A map with pins

OSM needs no API key, so a map works the moment you write it. Opens in a window of its own — a native view inside a scrolling page floats over everything around it.

Device
Recipes97 lines
Images

Decode once, keep the Image, reuse it. Loading inside onPaint or inside a list's bind step is what makes scrolling stutter where the pictures are.

Images
Recipes110 lines
Keyboard and focus

Tab follows the order you ADDED the fields, not where they ended up on screen. Build in reading order and the tab order is correct without being designed.

Input
Recipes161 lines
Writing your own component

Search dev/crossfly/ui first — most of what you are about to write is already there. When it genuinely is not, this is the shape.

Custom components
Recipes129 lines
Brand and dark mode

One seed generates the whole palette, for both themes. Nothing below names a colour, which is why the switch needs no rebuild.

Theming
Recipes160 lines
Empty, loading and broken

Three of these are usually left to render as blank space. Blank space reads as a bug, never as an answer.

FeedbackLists
Recipes249 lines
Files, sharing and printing

Ask the capability, not the platform. Phones, Windows 10+ and the Mac have the picker and the share sheet; Linux has no share sheet; a browser has the picker always and the sheet only sometimes. Printing takes a PDF, and every platform's own dialog does the rest.

Device
Recipes284 lines
Video playback

A native surface over the canvas, like the map. Ask the capability first: all five platforms have it now, and one that does not says so instead of showing black.

Devicemedia
Recipes120 lines
Embedded web page

A native browser over the canvas, at this component's rect. On the web it is an <iframe>, and script only reaches a page from your own origin.

Devicemedia
Recipes402 lines
Reading an odometer (OCR)

Show a strip, read the strip. The viewfinder is only as tall as the digits, and the recognizer gets that band and nothing else — so the speedometer and the trip meter around it never compete with the number.

Device
Apps2025 lines
Depot — offline-first CRUD

One shell, three listings over a local database, a detail and a long form. A thing you navigate away from is a Window; a thing you switch between is not.

DataListsForms
Apps495 lines
Pulse — a dashboard

One screen, read rather than operated: a headline number, a KPI grid and charts, all re-fed by the single control that changes the period.

Charts
Apps445 lines
Fieldwork — capturing from the device

Every capture has three states, not two: empty, captured, and unavailable on this device — and the third is the one a phone-only developer never sees.

Device
Apps1017 lines
Order entry — a wizard

A linear flow that validates per step, lets the reader walk back freely, and ends on a review built from the same data the steps collected.

FormsNavigation
For an AI assistant

Machine-readable versions of this page, so a model can read the shelf instead of guessing at the API.

Every example, as JSONllms.txt

Start from one of these

Pick the shape closest to what you are building, copy it, and change the parts that are yours.

Read the docs