Skip to main content

Customizing the screens in Express

Markdown

The call screen, the chat and the list of who is online can be made part of the design of your app, or changed down to their code, with your AI coding agent or by hand. Each step goes further than the last: making the screens your own has every detail.

1. The look​

The elements draw in a shadow root, and their colours are custom properties your page sets:

/* public/app.css */
call-screen, chat-room, online-list {
--wplus-color-accent: 37, 99, 235; /* red, green, blue */
--wplus-messenger-font: Inter, system-ui, sans-serif;
--wplus-radius-card: 14px;
}
  • Light and dark follow the system. wplus-messages-light or wplus-messages-dark on <body> keeps one, as does a color-scheme on the page that names one alone.
  • Words: the screens come in English, German, Spanish, French, Italian, Dutch, Polish, Croatian and Hebrew, in the language of the page (<html lang>), or the one screen: { lang } names in connect(). rt.callScreen( { strings: { 'End Call': 'Hang up' } } ) changes any of them by its English text.
  • Right to left: in Hebrew they draw mirrored, by the language they show.

2. A piece of your own​

Your stylesheet reaches each piece by its name, and a <template slot> draws one with your own markup:

chat-room::part(message) { font-size: 15px; }
call-screen::part(call-controls) { bottom: 24px; }
<!-- views/support.html -->
<chat-room room="chat:34:42" messages="/chat/34/42/messages">
<template slot="empty-conversation"><p>Ask us anything about your order.</p></template>
</chat-room>

<call-screen>
<template slot="control" data-control="notes" data-label="Call notes" data-icon="edit"></template>
</call-screen>

<script>
document.addEventListener( 'realtime-control', ( e ) => { if ( e.detail.control === 'notes' ) openNotes(); } );
</script>

Every part, every template and what fills it: on any page.

The names are plain words, so your pages name no one but your app. To put your own before each, screen: { prefix: 'shop' } in connect() makes <shop-chat-room> and <shop-call-screen> (your own names).

3. The code itself​

Copy a view into your app. It is React, built into your own elements script:

npm install @wordplus/realtime-ui
npm install -D react react-dom esbuild
npx @wordplus/realtime-ui add chat
node wordplus-ui.build.mjs # public/realtime-ui.js, with your copy
const rt = await connect( { ...config, ui: '/realtime-ui.js' } );   // yours in place of ours

The view is yours now: components/wordplus/chat/, and what runs the conversation stays in the package. Build again after each change. Check it with its tests (npx vitest run components/wordplus) and every state in the preview (npx @wordplus/realtime-ui preview). When ours changes, npx @wordplus/realtime-ui diff shows what to merge: when ours changes.

4. Your own interface​

The elements are the ready-made option, never a must. Draw who is online, the chat, the calls and the live stream with your own components, on the same API they are built on: your rules, encryption and connection stay the same. Your own interface shows the API under each element.

Live streams​

<live-stream> and <stream-studio> are the player, chat and studio of Easy Stream, with a look of their own: custom properties on .wplus-live-stream-theme, such as --wplus-live-stream-accent, --wplus-live-stream-radius and --wplus-live-stream-font, and their words in the same nine languages, by rt.streamScreen( { lang, strings } ) (live streams).

body .wplus-live-stream-theme { --wplus-live-stream-accent: #16a34a; --wplus-live-stream-radius: 12px; }

With your AI coding agent​

The agent skill of the package teaches it all of this. Ask for what you want, such as "show the customer order beside each message", and it changes the screens at the step that does it, then runs the tests and looks at the preview.