Skip to content
All posts

Shared UI for Web and Native: Components with Platform-Specific APIs

DaveOTF Kit
8 min read
Shared UI for Web and Native: Components with Platform-Specific APIs

Start with the buyer question

If you are evaluating a UI kit for a product that ships on web and mobile, “cross-platform” needs a precise definition. Can your team reuse design decisions and recognizable component concepts without pretending browser and native interfaces behave identically? That is the useful question. Marketing copy can make cross-platform reuse sound automatic, which can hide the work your team still needs to do.

A practical cross-platform system shares a vocabulary where that helps, shares design tokens where that is supported, and makes platform-specific APIs visible. The result is not one implementation stretched across every runtime. It is a deliberate relationship between implementations that your developers can inspect, test, and maintain.

What should stay consistent, and what should differ?

Consistency is a product decision, not a demand that every source file match. Before choosing a kit, decide which parts of your interface need a common design language and which need platform-native behavior.

AreaUseful consistencyWhat still needs a platform check
Component conceptsA button, card, field, or dialog can have a recognizable role across surfaces.A component may not exist on every platform, and its interface may differ.
Design tokensTeams can organize color, spacing, type, and shape around shared semantic names.Units, available styles, and rendering differ between browser and native environments.
InteractionA primary action should communicate the same product intent.Web and native input events, focus, touch targets, and accessibility APIs are not interchangeable.
Layout and outputScreens can follow the same hierarchy and design direction.CSS, native layout primitives, fonts, safe areas, and system controls affect the final result.

This distinction prevents two common planning mistakes. The first is choosing a kit because a demo screenshot looks alike on two devices. The second is rejecting useful reuse because the code is not literally identical. Compare the implementation contract, not just the picture.

Same component names. Web and mobile. One SDK.

The free, open-source SDK gives you web and React Native components with shared names and design tokens, from one SDK. github.com/otf-kit/sdk

Get the free SDK

Why API reuse needs limits

A component API is a promise to the code that consumes it. On the web, an action button participates in browser conventions such as keyboard focus and form submission. In React Native, a pressable surface has touch-specific behavior, including press-in, press-out, hit areas, and long presses. The platforms may use different properties and event handlers because they expose different capabilities. React Native documents those interactions through Pressable; the web platform defines its own button semantics.

Layout has the same boundary. Browser CSS and native layout are separate rendering systems. A web component that depends on browser-only style behavior does not become a native component based on its name alone. When a kit offers web and native packages, inspect each package’s examples and types instead of assuming that the import is the only change.

Accessibility also needs a runtime-specific review. A screen reader, keyboard, switch control, or touch user may encounter an equivalent product task through different platform conventions. Reuse can support consistent labels and intent, but test the actual native and web output. Do not infer accessibility parity from matching component names.

Treat names as a map, not a contract

Shared names make a codebase easier to scan. If both packages offer a Button, the name gives a developer a useful starting point. The packages may expose different property lists, variants, and states.

Keep package imports explicit so the platform boundary stays visible:

// Web surface
import { Button } from '@otfdashkit/ui'

// React Native surface
import { Button } from '@otfdashkit/ui-native'

These imports show related component concepts from separate packages. They do not establish that the exported components have identical interfaces. Read each package’s type definitions and usage examples before moving a screen or generating code with an AI assistant. If one surface accepts a property that the other does not, document the difference at the point where the team will make the choice.

A small interface note can be more valuable than a broad promise. For example: “The web package uses browser event and style conventions; the native package uses React Native interaction and style conventions. Check each package’s component API before porting.” This tells a developer what to verify and gives an AI agent a grounded instruction to follow.

Share design intent through tokens

Design tokens provide a stronger cross-platform seam than copied component props. A semantic name such as color.surface can tell a team what a value means; platform-specific code can then map that intent to its own supported styling system. The mapping needs to be explicit and reviewed. A token does not guarantee equal color appearance on every screen, and a shared numeric value does not erase differences in density, typography, or system rendering.

Use tokens to keep product decisions legible: which color communicates a primary action, what spacing scale the product uses, and how typography is grouped. Then validate the rendered result on each platform. Designers and engineers can compare information hierarchy and intent while allowing the implementation to respect its runtime.

A design token mapped to separate web, iOS, and Android size values

The practical test is whether a developer can find the source for a design choice and understand how each package consumes it. If a token is only present in one surface, the codebase needs a documented reason or a follow-up task; the interface should not imply that coverage exists when it does not.

Test a real workflow before adopting a kit

Pick one screen users actually need, such as a sign-in form, a settings panel, or a purchase confirmation. Use that slice to evaluate the kit before migrating a whole application.

  1. Inspect both package APIs. List the components the screen needs and confirm that each is available on the intended surface. Read the public types and examples for both packages.
  2. Trace an interaction end to end. Check the event handler, loading state, disabled state, validation feedback, focus or touch behavior, and accessibility labels in the web and native implementations.
  3. Compare design intent. Check hierarchy, semantic color, spacing, type, and shape. Record differences that come from platform behavior instead of marking every visual variation as a defect.
  4. Build and run both versions. A successful type check is useful, but it does not prove that the screen is usable on a phone or that browser keyboard behavior works.
  5. Write down the boundary. Keep a short mapping of shared concepts, package-specific props, and known gaps next to the screen or in your team’s UI documentation.

This process catches the expensive mismatch early: a kit can look reusable in a catalog while requiring different component choices or interaction work in the actual flow. It also gives an AI coding agent concrete evidence to use instead of a vague instruction to “make it the same.”

A small button example

The platform primitives make the distinction tangible. The following examples communicate a similar action while using each runtime’s own interaction property:

// Browser
<button type="button" onClick={saveChanges}>
  Save changes
</button>
// React Native
<Pressable onPress={saveChanges} accessibilityRole="button">
  <Text>Save changes</Text>
</Pressable>

The examples are not drop-in replacements for one another. The web button participates in HTML behavior; React Native’s Pressable exposes native press states and touch-area controls. If a component library wraps these primitives, verify what its wrapper preserves and what its public API intentionally changes. React Native’s documentation describes the press lifecycle and hit areas; MDN documents the web button’s HTML behavior.

Web and native button implementations with distinct platform-specific interaction controls

How OTF fits

OTF publishes separate web and mobile component catalogs. The component catalog currently describes 150+ web and 85+ native components and links to their previews. Treat each package as its own surface: compare the components and APIs you plan to use, and confirm that the examples match your application’s versions and requirements. A shared component name or design token is evidence of related intent; it does not make the package interfaces or output interchangeable.

For AI-assisted implementation, give the agent the correct package documentation and tell it which runtime it is editing. Ask it to inspect the package’s actual type definitions before it writes component props. Keep a review step that checks the generated code against those definitions and runs the relevant platform build. This helps catch invented variants, unsupported properties, and web-only assumptions before they reach a screen.

Start by choosing one workflow and checking the OTF component catalog alongside the React Native preview. If the components and boundaries fit, prototype that workflow on both surfaces. If a required control or behavior is missing, record the gap before committing to a broader migration.

Sources

Cross Platformdesign systemReact Native
OTF SDK + Kits

Buy once, own the code. Ship with the agent you already use.

  • Free, open-source SDK — same component, web and mobile
  • Paid kits include AI configs + 20+ task prompts per kit — your agent reads the whole project
  • $99/kit or $149 for everything. No subscription, no sandbox limit.
Free starter

Ship your first screen tonight — free starter in your inbox

The quickstart, the SDK repo and the live kit demos, on this screen and in your inbox.

No spam. Unsubscribe any time.

Free with your email

Get the free AI configs pack

The AI files every kit ships with. Drop them in and your AI tool knows your project.

  • CLAUDE.mdProject context
  • .cursorrulesRules for Cursor
  • prompts/Task prompts

No spam. Unsubscribe any time.