An AI chat: answers stream as Markdown with components (stats, a chart, a table, follow-up questions) and can be stopped, copied, rated and asked again.
Desktops have one layout. On phones and tablets the same markup can also lay itself out like a native app: or .
Code
Copy it into a page of your app. Load the CSS and register the components once (see framework setup); links point at routes like /orders that you replace with your own.
This template works: the page renders from data.ts (sample rows, replace them with your API) and behavior.ts makes its controls work. The behaviour file is the same in every framework.
<script type="module">
import '@prismora/css';
import '@prismora/elements/ai-response';
import '@prismora/elements/app';
import '@prismora/elements/app-bar';
import '@prismora/elements/avatar';
import '@prismora/elements/badge';
import '@prismora/elements/button';
import '@prismora/elements/card';
import '@prismora/elements/chat';
import '@prismora/elements/drawer';
import '@prismora/elements/icon';
import '@prismora/elements/indicator';
import '@prismora/elements/input';
import '@prismora/elements/list';
import '@prismora/elements/menu';
import '@prismora/elements/nav';
import '@prismora/elements/theme-settings';
import '@prismora/elements/theme-switch';
import { registerIcons } from '@prismora/elements/icon';
import { barChart, bell, box, columns, creditCard, globe, home, inbox, mail, messageCircle, packageIcon, plus, search, settings, sparkles, userPlus, users, zap } from '@prismora/icons';
import { data } from './prismora/assistant/data';
import { setup } from './prismora/assistant/behavior';
registerIcons([barChart, bell, box, columns, creditCard, globe, home, inbox, mail, messageCircle, packageIcon, plus, search, settings, sparkles, userPlus, users, zap]);
setup(document.body, data);
</script>
<pm-app mobile collapsible persist="lumen">
<aside class="pm-app-side" aria-label="Workspace">
<a href="/dashboard" class="pm-brand">
<pm-icon name="zap"></pm-icon>
<span class="pm-brand-name">Lumen</span>
</a>
<pm-nav label="Main">
<pm-nav-group label="Workspace">
<pm-nav-item href="/dashboard" label="Overview" icon="home"></pm-nav-item>
<pm-nav-item href="/orders" label="Orders" icon="box" count="12" count-label="{count} new"></pm-nav-item>
<pm-nav-item href="/customer" label="Customers" icon="users"></pm-nav-item>
<pm-nav-item href="/inbox" label="Inbox" icon="inbox" count="4" count-label="{count} unread"></pm-nav-item>
</pm-nav-group>
<pm-nav-group label="Work">
<pm-nav-item href="/analytics" label="Analytics" icon="bar-chart"></pm-nav-item>
<pm-nav-item href="/projects" label="Projects" icon="columns"></pm-nav-item>
<pm-nav-item href="/chat" label="Chat" icon="message-circle"></pm-nav-item>
<pm-nav-item href="/assistant" label="Assistant" icon="sparkles" current></pm-nav-item>
</pm-nav-group>
<pm-nav-group label="Admin">
<pm-nav-item href="/team" label="Team" icon="user-plus"></pm-nav-item>
<pm-nav-item href="/billing" label="Billing" icon="credit-card"></pm-nav-item>
<pm-nav-item href="/settings" label="Settings" icon="settings"></pm-nav-item>
</pm-nav-group>
</pm-nav>
<div class="pm-app-side-footer">
<pm-card class="pm-app-full" size="sm" surface="gradient">
<span class="pm-weight-semibold">Upgrade to Business</span>
<p class="pm-text-sm pm-muted">SSO, audit log and priority support.</p>
<pm-button slot="footer" size="sm" href="/pricing">See plans</pm-button>
</pm-card>
</div>
</aside>
<div class="pm-app-main">
<pm-app-bar nav-toggle>
<pm-input slot="search" type="search" label="Search" hide-label placeholder="Search…" icon-start="search"></pm-input>
<pm-theme-switch slot="end" class="pm-site-wide" variant="toggle"></pm-theme-switch>
<pm-button slot="end" variant="ghost" tone="neutral" icon icon-start="settings" label="Display settings" commandfor="display-settings" command="--open"></pm-button>
<pm-indicator slot="end" count="3" label="{count} unread">
<pm-button variant="ghost" tone="neutral" icon icon-start="bell" label="Notifications" href="/notifications"></pm-button>
</pm-indicator>
<pm-button slot="end" variant="ghost" tone="neutral" icon label="Account menu" popovertarget="account-menu" aria-haspopup="menu">
<pm-avatar slot="start" name="Ada Lovelace" size="sm" status="online"></pm-avatar>
</pm-button>
<pm-menu slot="end" id="account-menu">
<a role="menuitem" href="/profile">Profile</a>
<a role="menuitem" href="/settings">Settings</a>
<hr>
<a role="menuitem" href="/sign-in">Sign out</a>
</pm-menu>
</pm-app-bar>
<main class="pm-app-content">
<div class="pm-pane" data-width="prose" data-state="ready" data-ref="region">
<div class="pm-cluster">
<h1 class="pm-page-title">Assistant</h1>
<pm-badge tone="accent">Beta</pm-badge>
<span class="pm-spacer"></span>
<pm-button size="sm" variant="outline" tone="neutral" icon-start="plus" data-action="new">New chat</pm-button>
</div>
<div class="pm-pane-body pm-stack pm-justify-center" data-show="empty">
<div class="pm-stack pm-gap-2 pm-text-center">
<h2 class="pm-text-2xl pm-heading">What do you want to know?</h2>
<p class="pm-muted">Ask about your sales, orders, customers and products.</p>
</div>
<pm-list bordered divided label="Suggestions" data-ref="ideas">
<pm-list-item interactive value="Summarise last week’s sales and tell me what changed." icon-start="bar-chart" heading="Summarise last week" description="Summarise last week’s sales and tell me what changed."></pm-list-item>
<pm-list-item interactive value="Which countries drove the growth?" icon-start="globe" heading="Growth by country" description="Which countries drove the growth?"></pm-list-item>
<pm-list-item interactive value="Show the top products this month." icon-start="package" heading="Top products" description="Show the top products this month."></pm-list-item>
<pm-list-item interactive value="Draft a summary email for the team." icon-start="mail" heading="Draft an email" description="Draft a summary email for the team."></pm-list-item>
</pm-list>
</div>
<pm-chat class="pm-pane-body" data-show="ready" label="Conversation with the assistant" data-ref="thread">
<pm-chat-message from="me" name="You">Summarise last week’s sales and tell me what changed.</pm-chat-message>
<pm-chat-message from="them" name="Assistant" variant="plain">
<pm-ai-response value="Sales were **$48,210** last week, up 12% on the week before.
```ui
{"type":"grid","children":[{"type":"stat","label":"Revenue","value":"$48,210","delta":"+12%","trend":"up"},{"type":"stat","label":"Orders","value":"1,284","delta":"+8%","trend":"up"},{"type":"stat","label":"Refunds","value":"1.9%","delta":"+0.2%","trend":"down"}]}
```
- Orders rose from 1,188 to 1,284, mostly from search traffic.
- The **Business** plan made up 61% of revenue.
- Refunds were slightly up, at 1.9%.
```ui
{"type":"suggestions","items":["Which countries drove the growth?","Show the top products this month."]}
```"></pm-ai-response>
</pm-chat-message>
</pm-chat>
<pm-composer label="Ask the assistant" placeholder="Ask about your data" maxlength="2000" data-ref="composer">
<div slot="top" class="pm-cluster pm-gap-2" data-ref="chips">
<pm-button size="xs" variant="soft" tone="neutral" data-action="suggest" data-prompt="Summarise last week’s sales and tell me what changed.">Summarise last week</pm-button>
<pm-button size="xs" variant="soft" tone="neutral" data-action="suggest" data-prompt="Which countries drove the growth?">Growth by country</pm-button>
<pm-button size="xs" variant="soft" tone="neutral" data-action="suggest" data-prompt="Show the top products this month.">Top products</pm-button>
<pm-button size="xs" variant="soft" tone="neutral" data-action="suggest" data-prompt="Draft a summary email for the team.">Draft an email</pm-button>
</div>
</pm-composer>
<p class="pm-text-xs pm-muted pm-text-center">Answers can be wrong. Check important numbers against your reports.</p>
</div>
</main>
</div>
</pm-app>
<pm-drawer id="display-settings" heading="Display settings" description="Saved in this browser." side="end">
<pm-theme-settings></pm-theme-settings>
</pm-drawer>
With the CLI
npx @prismora/cli add assistant --write
Writes the page into your routes folder and both files into prismora/assistant/.