Skip to content

Archetypes

Eleven screen shapes. A view is one of these — if a screen fits none, the screen is wrong, or a new archetype is proposed here in its own MR first. Each entry names a real class to copy, and every one of them still has to clear the design bar.

1. Dashboard / multi-card

Purpose: the landing screen — headline numbers, then charts, then a short list. Canonical: PortfolioView · .portfolio-view

Mockup: mockups/portfolio.html — the approved shape of this archetype, rendered against the real theme. The market variant has its own page, mockups/market.html.

Skeleton: a GridLayout with one row per band, in order.

grid.addRow(highlight1, highlight2, highlight3, highlight4);  // stat band: four, one line
grid.addRow(latestReportStrip);                               // one line, not a card
grid.addRow(timelines);                                       // charts
grid.addRow(topChangePositions, distribution);                // lists

A "highlight" (class="kpi") is a VerticalLayout with Padding.LARGE, setPadding(false), setSpacing(false), holding an H2 label (FontWeight.NORMAL, Margin.NONE, TextColor.SECONDARY, FontSize.XSMALL) over a Span value (FontWeight.SEMIBOLD, FontSize.XXXLARGE). A change badge is added as a third child when the figure has a delta, one theme name per add().

The stat band is four cells, not five: .grid-layout floors every child at 300 px, so a fifth cell wraps at 1440 (1184 px of content) and the wrap is what pushed the list band below the fold. Anything that is a link rather than a metric — the latest report — belongs on its own one-line strip under the band.

Do: keep the row count small; let GridLayout collapse it on mobile (a highlight becomes a compact label-left/value-right row there). Don't: build a custom responsive grid, put a table in the first row, or give a non-metric the weight of a highlight card.

Variant — market dashboard. MarketView (.market-view) is the same band structure with the table as its spine: four figures (market cap, BTC dominance, fear & greed, 24h volume), one overview row, then the instruments table — which takes the rest of the viewport and ends the page. Nothing sits below it.

  • The overview row is the only row above the table. MarketOverviewSwitcher is a NativeDetails whose summary is a pill Tabs (class="row-tabs") — the two text panels (AI reports, News) and the three chart series in one set, so the page carries a single button row. It opens on News and collapses on a click on its own header.
  • A pill selects, the row toggles. A click on a pill is cancelled so it selects instead of collapsing the row it lives in, and the same handler opens the row — the selected pill fires no selection change, so the server cannot be the only opener. The cancel has to be a plain browser listener on the row, filtered to .row-tabs: a native <summary> toggles on any click inside it that is not interactive content, and Flow's preventDefault() is a listener filter, so attaching it to the tabs runs before Vaadin's own click handling and the selection never happens. Do not ask the clicked pill whether it was selected: the event bubbles through the tabs, so it is already marked by the time the row sees it.
  • Every panel is the same fixed box. 360 px on desktop (336 px of chart, which is what a timeline with a navigator and a range selector needs) and 240 px at ≤768, both guarded by min(360px, 45vh). Switching a panel therefore never moves the table, and only a collapse changes its height. The text panels are lists of up to eight rows that scroll inside the box.
  • One row anatomy in both text panels. A leading 40 px tile (the article's image, the agent's robot icon), then the source line, the headline and a detail line; the row itself is the link, so it carries no trailing button.
  • The table band flexes. .market-view is a column, the bands are flex: 0 0 auto, the table band is flex: 1 1 auto with min-height: 0, and the grid is setHeightFull(). Collapsing the overview row gives its height back to the table; the page never scrolls. This is the deliberate exception to no nested scroll containers: the grid fills the viewport and scrolls its own rows, and MainLayout does not scroll on this screen.
  • A figure with no source yet keeps its cell. 24h volume has no source in the API; the band renders the cell with — rather than dropping it and re-shaping the band when the source lands.
  • One toolbar, one action. The filter row is the only toolbar (no columns menu), and each row carries one Trade action that opens Buy/Sell in a ContextMenu — two buttons per row is 42 buttons on a 21-row table. The action column carries no header: a label there only spends width the numbers use.
  • Columns follow the decision. Asset · Latest · 24h · 7d on desktop (isColumnVisibleOnDesktop hides 30d), Asset · Latest · 24h · Trade on mobile.
  • No quote band. It is unactionable, and it rendered an empty Span when there was no quote.

2. Detail, uni-column

Purpose: one entity, read top to bottom, in a column narrow enough to read. Canonical: StrategyView · .uni-column-view · also InstrumentView, PositionView

Skeleton: setSizeFull(), a GridLayout, addClassName("uni-column-view"), then one addRow per section — info, actions, transactions/timeline. The CSS sets display: block; margin: 0 auto; max-width: 1024px; width: 100%, and drops the max-width on mobile.

Do: one section per row; put the summary card first. Don't: put a second column beside the main one — that is the form-with-aside archetype.

InstrumentView combines .instrument-view with .uni-column-view; the extra selector only widens the column for the price chart.

3. List with filters

Purpose: a grid of records with a filter bar and a create action. Canonical: StrategiesView · also PositionsView, TransactionsView, ConnexionsView, EventsView

Skeleton, repeated in all five:

HorizontalLayout hl = new HorizontalLayout(addButton, nameFilter, gridColumnsMenu);
hl.addClassNames(LumoUtility.Padding.MEDIUM, LumoUtility.Padding.Bottom.NONE);
VerticalLayout main = new VerticalLayout(hl, grid);
main.setPadding(false);

The grid carries LumoUtility.Margin.SMALL. Empty state is EmptyPortfolioLayout in place of the grid, with Padding.Vertical.NONE.

Do: keep the filter row in one HorizontalLayout above the grid. Don't: give the grid its own scroll container — MainLayout already scrolls.

4. Form with aside

Purpose: a form plus a live summary beside it. Canonical: DcaView · .form-with-aside-layout · also ScalpView, ClosePositionView, AddTradeView, AddWithdrawalView

Skeleton: addClassNames("form-with-aside-layout"), then a Main containing a Section (the form) and an aside component.

Main main = new Main();
main.add(formSection);   // title + form
main.add(summaryAside);  // DcaAside, ScalpAside, ClosePositionAside, TradeBalancesAside, WithdrawalAside
add(main);

The CSS makes .form-with-aside-layout a full-height flex column; main is a centered grid, gap: var(--lumo-space-xl), max-width 1200 px; section is a growing flex column. The aside class name is <Domain>Aside, in <domain>/component/ or <domain>/template/component/.

Do: keep the aside to a summary — totals, balances, a confirm action. Don't: put a second form in the aside.

5. Form, simple

Purpose: a form without a summary — tabs, or a single column. Canonical: AddTransactionView · .credit-card-form-view · also OrderView, TransferView, ActionFormView, AddActionFormView

Skeleton: addClassName("credit-card-form-view"), an H3 section title, a Paragraph note, then a TabSheet when the form has variants (Deposit, Withdrawal, Buy, Sell). CSS: max-width 1024 px, centered, padding: 0 var(--lumo-space-l).

6. Timeline chart

Purpose: a metric over time. Canonical: PositionUplTimeline · also PortfolioUplTimeline, StrategyUplTimeline, StrategyChangeTimeline, InstrumentPriceTimeline, MarketCapTimeline

Naming is <Domain><Metric>Timeline, in <domain>/chart/. The plural containers — TimelinesComponent, PositionTimelinesComponent, StrategyTimelinesComponent — are GlacezComponents that stack several timelines and are what views actually add.

Do: add the container, not the individual chart, when a view shows several. Don't: name a chart <Something>Chart when it is a time series — Timeline is the convention, and the Chart suffix is reserved for the switcher and gauge shapes.

7. Switcher / gauge

Purpose: one visual, several metrics to choose between, or a single bounded reading. Canonical: MarketOverviewSwitcher · also FearAndGreedGauge, DominanceAreaChart

A switcher owns its own metric selection and re-renders in place; the view adds one component and does not wire buttons. A gauge is a bounded scale — fear and greed — and is not a timeline.

8. Report

Purpose: a long markdown document produced by the AI agent. Canonical: ReportViewLayout · .glacez-report-markdown · also PortfolioReportView, PositionReportView, BtcTrendReportView, NewsDigestReportView, AiAgentView

ReportViewLayout is a final utility class with a static mountMarkdownReport(Div root, H3 heading, Paragraph meta, String markdownContent). It builds a Markdown body (max-height: 70vh, overflow: auto), wraps it in a Div with Padding.MEDIUM, Border.ALL, BorderRadius.MEDIUM and the glacez-report-markdown class, and mounts VerticalLayout(heading, meta, bodyWrap) into the root after removeAll().

Do: call mountMarkdownReport and let the CSS own the typography. Don't: style markdown inline, or copy the body wrapper into a new view.

9. Profile / settings

Purpose: the signed-in user's own data and preferences. Canonical: UserProfileView · also InvestmentProfileView

A Composite<VerticalLayout> split into labelled sections. Each section is a heading plus its fields — no aside, no tabs.

10. Auth / onboarding

Purpose: entry points — sign in, first-run choices, home. Canonical: LoginView · also HomeView, OnboardingView (.onboarding-view), OnboardingChoiceButton

HomeView is the only view outside MainLayout (route /home). OnboardingView is a grid of choices — an OrderedList of OnboardingChoiceButtons; .onboarding-view lays that grid out (li in a responsive minmax(256px, 1fr)), which is the only thing that class does.

11. Feed

Purpose: a scrollable stream of news items. Canonical: FeedView · .feed-view · also NewsFeedPanel

Skeleton: addClassName("feed-view"), a HorizontalLayout top bar (title Span with FontSize.LARGE, FontWeight.BOLD, plus a navigation button), then the NewsFeedPanel. CSS makes .feed-view a full-height flex column; NewsFeedPanel.embedded shrinks instead of filling.