Skip to content

Build screens

A plugin’s screens are React components in client/. Ryot compiles them, loads them into an isolated frame inside the app and gives them a small SDK to read data, run actions and navigate. This page walks through the pieces, using the Houseplants plugin from the quick start.

Screens are listed in the manifest’s client section. Each file under exports is one entry point whose default export is a React component:

client: {
homeView: null,
apiVersion: CLIENT_API_VERSION,
routes: { "/": "home", "/new": "new-plant" },
entities: { plant: { detailPage: "plant-page" } },
exports: {
home: page("client/home.tsx"),
"new-plant": page("client/new-plant.tsx"),
"plant-page": page("client/plant-page.tsx"),
},
},
  • exports names each entry. Its kind is page for a full screen, component for a piece other plugins or pages can import, presentation for how an item looks in a list or grid, or analytics-section for a section of the Analytics screen.
  • routes maps addresses inside your plugin to pages. / is the workspace home. A segment that starts with $, such as /plants/$plantId, is a parameter.
  • entities chooses what Ryot shows for your entity types: a detailPage when someone opens one, listPresentation and gridPresentation for views, and an optional createRoute.
  • homeView can name one of your saved views to use as the workspace home instead of a route.
  • notFoundPage can name a page to show for unknown addresses.

Your plugin’s pages live at /p/<publisher>/<name> in the app. You never write those addresses yourself: navigate with route targets, as shown below.

Wrap each page in PluginScreenFrame. It renders the title bar, back button, actions and spacing the same way every Ryot screen does, on phones and desktops:

<PluginScreenFrame title={message("home.title")} primaryAction={<Button>…</Button>}>
…
</PluginScreenFrame>

The frame also takes actions, menuActions (collected into a More actions menu) and a hero image area.

Build the content with components from @ryot-app/plugin-ui-sdk, such as Button, StatusMessage, QueryStatus, Modal, Tabs and TextField, and style it with Tailwind utility classes. Ryot’s colors are available as classes such as text-text, text-text-muted, bg-surface and border-border, and they follow the user’s light or dark theme.

Every piece of text comes from your message catalog:

  • useMessages(PLUGIN_PACKAGE_ID, catalogMessage) returns a function that renders a message to a string for use in JSX, such as text("home.empty").
  • useStampedMessages(PLUGIN_PACKAGE_ID, catalogMessage) returns messages for props that Ryot renders itself, such as a PluginScreenFrame title.

Format numbers, dates and lists with useFormatters(), so they follow the user’s language.

Data comes from recipes: typed RyotQL queries with a schema for each selected field. Wrap a recipe in createRyotQuery and read it with useRyotQuery:

const plantsQuery = createRyotQuery(({ client }) =>
client.data.query(plantsRecipe(client.pluginIdentity(PLUGIN_PACKAGE_ID)), {}),
);
const plants = useRyotQuery(plantsQuery);

client.pluginIdentity(PLUGIN_PACKAGE_ID) tells the query which installation’s entity types to read. QueryStatus from the UI SDK shows loading and error states and calls its children with the data once it has loaded.

Queries refresh automatically after your plugin’s actions change data. For long lists, use useRyotInfiniteQuery and show a load-more state from isFetchingNextPage. The queries reference explains recipes, parameters and paging.

To change data from a screen, call one of your plugin’s operations with createRyotMutation and useRyotMutation. This button records a watering through the water-plant operation built in Backend code:

client/water-button.tsx
import {
createRyotMutation,
useMessages,
useRyotMutation,
} from "@ryot-app/plugin-client-sdk/react";
import { Button } from "@ryot-app/plugin-ui-sdk";
import { catalogMessage } from "../shared/messages.generated";
import { PLUGIN_PACKAGE_ID } from "../shared/plugin-identity";
import { WaterPlantInput, WaterPlantOutput } from "../shared/water-plant";
const waterPlant = createRyotMutation<typeof WaterPlantInput.Type, typeof WaterPlantOutput.Type>(
({ input, client }) =>
client.operations.invoke({
input,
slug: "water-plant",
output: WaterPlantOutput,
inputSchema: WaterPlantInput,
packageId: PLUGIN_PACKAGE_ID,
}),
);
export function WaterButton(props: { readonly plantId: string }) {
const water = useRyotMutation(waterPlant);
const text = useMessages(PLUGIN_PACKAGE_ID, catalogMessage);
return (
<Button
variant="secondary"
disabled={water.isPending}
onClick={() => water.mutate({ plantId: props.plantId, wateredAt: new Date().toISOString() })}
>
{text("home.water")}
</Button>
);
}

If the operation refuses the request, the error carries the operation’s own message. Show it with formatError(t, error) from @ryot-app/plugin-client-sdk/react.

For entity types with an editor, you do not need an operation to create or edit them: EntityEditorScreen from @ryot-app/plugin-client-sdk/entity-editor renders Ryot’s form and saves it for you.

  • PluginLink renders a link: { kind: "entity", entityId } opens an item, and { kind: "plugin-route", packageId, path } opens one of your routes.
  • useRyot().navigation.push(target) and .replace(target) navigate from code.
  • usePluginParams() reads route parameters such as $plantId, and usePluginSearch() reads the query string.
  • usePluginLocation() tells an entity page which item it is showing:
const location = usePluginLocation();
if (location.kind === "entity") {
// location.entityId and location.entitySchemaSlug
}

Ryot keeps scroll position and focus as people move back and forth, so do not reset them yourself.

Need Use
Remember something on this device usePluginStorage. The frame has no localStorage.
Read the user’s plugin preferences usePluginUserSettings, for fields in your manifest’s userSettingsSchema
Upload a file client.uploads.uploadTemporary or uploadPermanent
Show items in a list or grid defineEntityPresentation and EntityResults
Suggest prompts to Ryo client.assistantStarters and client.assistantInstructions in the manifest

The client SDK and UI SDK READMEs in packages/plugin-client-sdk and packages/plugin-ui-sdk describe every export, and plugins/fixture/client uses most of them.