Skip to content

Frontend Style Guide

A design system page at /styleguide renders every shared primitive, colour role and layout pattern in the browser. Check it for an existing primitive before building a new one.

flowchart LR
    tokens["Foundations<br/>colour roles, type, spacing"] --> elements["Elements<br/>icons, badges, banners"]
    elements --> components["Components<br/>buttons, fields, tables"]
    components --> patterns["Patterns<br/>page shell, row lists, settings"]

The Page

  • Lazy-loaded at /styleguide, deliberately linked from nowhere, without an auth guard. No production data on the page.
  • Source: frontend/src/app/features/styleguide/, one component per section page.
Section Contents
Overview The rules below
Foundations Colour roles, type scale, spacing, border radius
Elements Icons, logo, badges, copy fields, read-only rows, message banners, tables, feedback, evaluation status, star button, status icon, charts, toasts
Components Buttons, form field, name with availability check, selection, panel switcher, table, overlays
Patterns Page shell, row list, index cards, card grid, settings, sections with an action, settings destinations, danger zone

Rules

  • Surround store paths, hashes, keys, IDs, and URLs with gr-copy-field. A plain code span won't do. The multiline gr-copy-field can grow to fit the content.
  • Take all colours from semantic roles. Hex values belong only in the palette, and components read roles rather than palette tokens.
  • Put new shared classes in the design system. Component stylesheets take none.
  • Build content layouts from gr-row-list or gr-card-grid. Avoid entity-specific names.
  • Keep every element readable in both themes. Never hard-code black or white in a component.
  • Color text on tinted status backgrounds with the matching --gr-status-*-text role. Never use plain status roles. Fix contrast violations in tokens.ts, not on the page side. contrast.spec.ts must keep all text roles at 4.5:1 on the base, raised, hover, and sunken surfaces in both themes. Underline links in body text.
  • Never write color literals (hex, rgb(), hsl(), or color names) or palette variables outside tokens.ts. Both make pnpm colors:check fail. The chart can take role names such as --gr-chart-cyan or --gr-graph-success in [colors] and SVG drawn in code can set style.fill or style.stroke to var(--role), so both follow the theme.
  • Use buildPhase, evaluationPhase, or execJobPhase. Then use gr-status-badge, gr-status-icon and PHASE_SEVERITY for gr-badge and PHASE_COLOR for graphics. PHASE_COLOR is the only map from phase to color: gr-status-icon and the tint of gr-status-badge read it through the --phase-color custom property. Don't add per-phase color rules to component styles; read --phase-color instead to give each phase its own status color. Queued, running, waiting, failed and canceled jobs show the same color on every page.
  • Pass the waiting_reason of an evaluation to evaluationPhase and gr-eval-status-badge. Only queued or running evaluations with a waiting reason show the waiting phase and the "Waiting" label. Building evaluations with a wait for exec jobs show the same waiting phase and label. Without a waiting reason, evaluations keep their own phase. Give the queued badge a dashed outline and a hollow center. Give the aborted badge a solid fill. Both badges never look the same.
  • Use severity colors on gr-badge only for a status or state. Badges for category names, such as trigger type or action type, stay neutral. Green, amber and red then always mean status. Neutral badges keep the case of their text, because they often show user values such as label, role or worker names. Status badges with a severity show their text in uppercase.
  • Render every page inside the single <main id="main-content"> of the app shell, never add a second <main>. Give each page exactly one h1, hidden with .sr-only when the layout shows no title, and never skip a heading level. Card, chart and empty-state titles are h2.
  • Give every icon-only button or link a name through label or aria-label, and name the target ("Remove bob", not "Remove"). pnpm button-names:check fails on an unnamed icon-only button. A gr-copy-field or gr-select inside a gr-form-field takes the field label. The outer one can pass label to the copy field and ariaLabel to the select.
  • Use @shared/ui's entityKindToIconName for project, task, cache, and team icons in every place with the entity on screen (rows, cards, empty states, invite lists). Don't enter Material icon names for those entities in templates.
  • Use gr-entity-name from @shared/ui in lists, rows, cards, and requests to show a project, task, cache, or team. Render the display name. Render the slug in muted monospace text when the slug and display name differ. Two items with the same display name stay distinct. Use gr-nav-card to project the entity with slot="title". Set [title] to formatEntityLabel(item) for the tooltip. Use formatEntityLabel() for plain text such as confirmation targets, aria labels, and toasts (for example, "Web Shop (shop)"). Pickers build options with entityToPickerOption() and filter with doesSearchQueryMatchEntityNameOrSlug(). Users can find an item by either name. Detail pages show the slug for the CLI (project, project/task, cache, team) as inline gr-copy-field in the header. Breadcrumbs and page titles keep the display name.
  • Pass the display name of the starred item to gr-star-button (starredItemDisplayName). Use that name as the button label ("Star Web Shop"). Restore the button to its original state after a failed star or unstar action. Then show a failure toast with that name.
  • User menu commands close the header drawer on narrow screens before they open a dialog or navigate. Dialogs never show behind the drawer.
  • Add grScrollRegion to every element that scrolls on its own, so keyboard users can focus and scroll it while its content overflows. gr-table and the log viewer already do this.
  • Table rows that open a page on click need a real link (routerLink) in the main cell too. Keyboard users can press Tab to reach the link and open the link in a new tab. Stop the click on that link from reaching the row handler. Use a button for rows that open a dialog. Don't rely on a click handler on tr or div alone.
  • Sidebar rows with their own menu button (build rows in the evaluation log, the Log row of the exec job page) select the row with a transparent .sidebar-row-link button stretched over the row, from shared/log/log-sidebar.scss. The .sidebar-kebab menu button sits beside it, so both can be reached with Tab and no control is nested inside another. Open the same menu on right-click of the row.
  • Make the full page fit at 375px and 768px widths without horizontal scroll. Set min-width: 0 on flex and grid children. Allow the header row and action row to wrap. Wide tables scroll inside gr-table. Bind [grDrawer] and (grDrawerClose) on all side panels that slide over the page and overlap content on narrow screens. Escape can close the panel from anywhere. Move focus into the panel on open. Return focus to the button that opened the panel on close. A menu inside the panel can already handle Escape (the event has defaultPrevented set). That Escape can close only the menu and leave the panel open. The panel of the header menu is a modal dialog while open on narrow screens (role="dialog", aria-modal).
  • Keep text sizes within one step of body size: 16px for interactive text, 14px for secondary text, 12px for badges only.
  • Report the result of every write through NotifyService (success, failure), which shows a gr-toast. New results replace the previous toast. Later successes leave no old failure toast beside them. A failed write submitted from an open gr-dialog keeps the dialog open and shows the reason through its [error] input. Take the reason from apiErrorMessage(error, fallback), never from the message of an arbitrary error. Toasts appear at the top right. They sit directly below the header with the page title while that header is visible. Otherwise they sit directly below the app header. Toasts don't cover header actions. They span the full width on smartphones, so they don't cover the save row, the dialog footer, or the fixed footer.
  • Use ApiService.getBlob and saveResponse from @shared/download to download small files such as logs and SBOM files through the API. Report failures through NotifyService.failure. Failed requests show raw JSON outside the app. Don't link these API URLs for download in [href]. Artifacts from a build can reach several gigabytes. Link the artifacts directly. Add an aria-label with the file name and the download attribute. The download manager of the browser can then show progress and resume the download. Keep direct links for HTML artifacts that open in a new tab.
  • Bind [busy] to gr-dialog while a request is active. Bind [loading] to the button that sent the request. The dialog can't close and a second request can't start. Set [closable]="false" on a dialog that can display a secret once, and show the secret in gr-copy-field so it has a copy button.
  • gr-dialog puts focus on the first form field when it opens. A dialog without fields focuses the first footer button, which is the safe action such as Cancel, never the close button. Mark a different start element with cdkFocusInitial. gr-dialog and [grDrawer] keep Tab inside while open and return focus to the opening element on every close.
  • After each client navigation except the first page load, the app moves focus to #main-content, unless focus already sits inside it (page tabs, a field the page focused). Pages don't need their own focus code for this.
  • Remove the row from the list after deletion without a reload. Move focus to the first button in the replacement row. Move focus to the page heading with no next row. Code can focus the h1 in gr-page-layout because of the tabindex="-1" on that element.
  • Set confirmDiscard to gr-dialog while unsaved edits exist in the form. Escape, the backdrop and the close button ask "Discard changes?" inside the dialog rather than close the dialog. Connect the Cancel button to the dialog's close() through a template reference. Cancel can ask too. Leave the input off for dialogs without edits. Track edits in dialogFormChangesSinceOpen of @shared/forms. Call mark() at dialog open, and bind [confirmDiscard] to changed().
  • Use HtmlOverflowHiddenScrollStrategy in packages/ui/src/ui/overlay to lock page scroll in gr-dialog, not the block strategy in @angular/cdk/overlay. Use the same strategy for any new overlay with a scroll lock. The block strategy can scroll back to the original position on close. That strategy can also cancel the scroll back to top after dialog actions open another page. Focus can move to #main-content on close when the original element that opened the dialog is gone.
  • Option groups such as gr-select-button and gr-tab-switch keep only the selected option in the tab order. The arrow keys, Home, and End move between options through getNextOptionIndexForKey() from packages/ui/src/ui/next-option-index-for-key.ts. Use that helper for new option groups.
  • Place app-settings-access-state-badge of @shared/access in the after-title slot of gr-page-layout on all project, cache, task, and team pages with the server configuration settings. Badges for settings that come from the server configuration show 'Managed' with a lock icon to every visitor. The badge tooltip gives the reason. The cache badge can also tell users with edit permission that the Deactivate button can still operate. Set showReadOnlyNote on the badge on settings pages (project, task, cache, team) as well. Read-only users then see a 'Read-only' badge. Pass the permission of the form to the permission input of the badge. The tooltip can then show the lowest built-in role that can edit. Don't disable actions that are not available. Hide them instead. Use *appWritable to render Create, Add, Delete, Unsubscribe and Edit buttons only for viewers with permission on unmanaged settings. Use @if (!row.managed) to control buttons on a single managed row. Form fields stay visible but disabled so users can read the value. Use [appManagedDisable] to set the reason as their tooltip. A single managed row on a page without the 'Managed' badge shows app-server-configuration-managed-lock-button. Never show a visible reason text on the row. Put the reason only in the tooltip for a control disabled for another reason. Use disabledReason on button[grButton] and on greyed-out gr-menu items. Actions that the backend can perform on managed entities stay visible and enabled. Use canEdit alone to control them. Examples include Activate/Deactivate of caches and upstreams and Test of upstreams. These pages show the save row and Danger Zone only with AccessService.isWritable(access) set to true. Set gr-form-field to hide the required asterisk on disabled or read-only controls.
  • Confirm beforehand through ConfirmService from @shared/confirm on every deletion, removal, cancellation, rejection, abort, drain, and secret rotation. State the exact target and say the outcome. The dialog can run the action itself, remain locked during the action, and show failures inside. Never use the native browser confirm(). Set isIrreversible on irreversible actions instead of writing a custom "cannot be undone" sentence. The dialog can then close with a single fixed message. Callers get the result from ConfirmService only on dialog close, so move it into subscribe after deletion.
  • Pass all metric series to gr-metric-chart, also an empty one. A chart whose series hold no points says "No data" over the plot, so an empty chart never looks like a broken one. ApiService rejects a response without a body (except 204 No Content) as an ApiError, so a page shows its error state instead of crashing on undefined.
  • A failed source is not an empty source. On a page with several requests, a part whose request failed shows "Couldn't load" (stat card value, table empty row, gr-metric-chart [error]). Empty texts such as "No data" or "No connected workers." appear only for data that loaded and is empty. Start such signals at null and keep them null on failure.
  • Pass missing values to gr-metric-chart as null, never as 0. Never let a zero bar mean "not reported". Default series colors don't include --gr-graph-danger. Show red only when [colors] can set red for failures.
  • Set all time-based charts on the Job Board to one shared axis. Use metricPointsTo24HourChartSeries() from features/board/hourly-metric-points-to-24-hour-slots.ts for that axis. Choose 24 hourly buckets. The last bucket is the current hour that is still in progress. This shows activity immediately. Show 0 for counts and a gap (null) for gauges in an hour with no rows. Lines never connect two timestamps across an empty time bucket.
  • Include the hide-cell-below-small-breakpoint mixin from features/board/_phone-width-hide-cells.scss in tables on the Job Board that don't fit in 375px. Add the class job-board-table-cell-hidden-on-phone to the secondary columns (rank, worker, method) in both th and td. The project, name and main value columns stay visible at all times. A 375px phone can display this table without horizontal scroll.
  • Set --gr-graph-success for completed builds and connected workers. Set --gr-graph-warning for draining workers in Job Board charts. Use --gr-chart-cyan, --gr-chart-purple or --gr-chart-teal for a series without status (jobs per worker or build time per project, for example). Never use green or orange. Green and amber then always mean status. Use gr-live-status for one status badge (LIVE or RECONNECTING). Show connection state through aria-label.
  • Two line series in gr-metric-chart can take the same values (for example, build closure size and runtime closure size). Set isLineDashed on the second series in that case. Otherwise, the second line can hide the first line, and the chart shows only one series.
  • Build all ECharts options from resolveChartTheme(). It sets reducedMotion on its own from the system setting (prefers-reduced-motion) and charts then skip animation. gr-metric-chart draws within 300 ms and can pin the first and last time labels of a line chart to the plot edges, so labels never get cut off. Charts with yAxisMax show evenly spaced ticks up to that maximum.
  • Control access to all write controls through the permissions that the endpoint can check, not through role names. Project, task, and cache responses list the caller's own permissions. Build the gate with accessTo(resource, ...permissions) (or injectTaskAccessTo / injectCacheAccessTo). Pass the gate to *appWritable for buttons and to [appManagedDisable] for form fields. [appManagedDisable] can also receive a busy flag as [disabled] in the same field. Combine both. Use [disabledReason] to bind a reason for the block on a single button (the last administrator). A button can remain focusable and show the reason as a tooltip.
  • Mark gr-menu items that can't run with disabledReason, not disabled. Menus always show the reason below items, so layout doesn't change between pointerdown and click. Arrow keys and initial focus skip that item. Test pointer events in the actual event order (pointerdown, mousedown, focus change, mouseup, click).
  • A role can grant only permissions available to the granting user (for example, API key permissions). In that case, pass the permissions available to that user to the selectablePermissionIds input of app-permission-picker. The picker can keep the other permissions visible and disable them. Don't filter the list on the page or check boxes again. The picker shows three groups labelled "Read", "Write" and "Admin", sorted by the lowest built-in role that grants each permission. Custom role forms set viewPermissionIsRequired, so the view permission stays ticked and locked; the server adds it to every custom role.
  • Show a refused load through gr-load-state: pass the 403 or 404 error as it is, and the component shows one "No access" or "Not found or access denied" state with a lock icon and no Try Again button. A page that knows the role can't read a list passes createMissingPermissionLoadStateError(owner, isViewerMember) from @shared/access and sends no request. Pass isViewerProjectMember(project) or isViewerCacheMember(cache) as the second argument. Pass the permission for the page as the third argument. This text can display the name of the lowest built-in role with that permission. An example is "Only the members with Write or Admin on this project can view this." Members see the admin text if that permission is absent. Visitors outside the project or outside the cache see the member-only text. Texts for denied access show the role name, not the permission. Pages where all sections need membership show one "No access" state for the whole page, not for each section. Never add a separate retryable flag or a page-specific no-access title.
  • Only read requests during router navigation can replace the page with the error page or show the throttle notice (PageRenderTracker in core/interceptors). Read requests before the first render after navigation can do the same. Later read requests, such as polling, retries, load more and search, show the failure inline on the page.
  • Mark reads that fill one section of a page with its own inline error state through asSectionRequest() of @core/interceptors/request-context. A busy server (429, 502, 503, 504) then leaves the page in place and the section shows the error, as the dashboard does. Reads that render the whole page stay unmarked and open the error page.
  • Build a page from sections that each load their own data. Show one page-level gr-message-banner and one Retry on any section failure. Hide the failed sections. Make Retry reload only the failed sections. Don't show one error banner per section.
  • Route guards and resolvers load the entity named in the URL (project, task, cache, team, evaluation, build, job, worker). They pass a refusal from @core/routing/access-denied through denyOnRefusal. It treats 400 (a malformed id), 403 and 404 the same way. Signed-in users see the shared "Not Found or Access Denied" page instead. Anonymous visitors go to the sign-in page with the requested address set in next. Sign-in can grant access. Give the denied target a name only for entities with a readable name; leave it out for ids, so the page says "Exec job not found." instead of showing a UUID. Pass the owning project to denyOnRefusal or notFoundPageRedirect, so the back link leads to that project when the user can read it and to the fallback list otherwise.
  • denyOnRefusal can check with the server that the session is still valid before the access denied page can appear for a signed-in user. Expired sessions go to the sign-in page with the reason visible and the address in next. The router can never send that session to the access denied page. The 403 page can show "Admin Only" only for addresses under /admin. That page can show "No Access" for every other address. Superusers don't see the Switch Account button.
  • Place the gr-load-state for the page inside the gr-page-layout, never outside that layout. The breadcrumb trail and title remain visible during page load and after a failure.
  • Teams have roles instead of permission lists. Team routes resolve the team once with teamAccessResolver, and pages read it with injectTeam() instead of fetching it again. Gate admin-only team controls and requests with canManageTeam(team, user), which also lets superusers in. A page whose content only members or admins may read shows createNoAccessLoadStateError(owner, group) and sends no request.
  • Endpoints for project members only cover roles, workers, SSH keys, cache subscriptions, SOPS recipients and task triggers. These endpoints cover actions, flake input overrides, task repositories, Git host connections and cache teams too. These endpoints all return 404 to everyone outside the project or cache, including superusers. Use requestIfProjectMember(projectOrTask, request) to wrap these requests and isViewerProjectMember(projectOrTask) to hide links to these pages. Use requestIfCacheMember(cache, request, permission?) to wrap cache requests. Use isViewerCacheMember(cache) to hide links to these cache pages. Requests from outside the project or cache fail immediately with the matching access denied error and send nothing. Requests without the given cache permission follow the same rule.
  • Signed-in users who change their own role or remove themselves from a project, cache, or team reload the resolved resource into the page's linkedSignal. Access gates then recompute. Send users without access to the project, cache, or team list page. Show pending invitations only to users who can manage members.
  • Bind a save-on-change select to the pending value during the request. At all other times bind it to the saved value. Clear the pending value after a failed request. The select can show the saved value again. Write the new value into the list after a successful request. Don't reload the list.
  • Show the role select in a member row only to users who can manage members (*appWritable). Other users see the role name as a neutral gr-badge, same as on the page for Team Members. They don't see an empty select or a disabled select. Team roles arrive in lowercase (admin, member). Pass them through the teamRoleDisplayLabels map from @shared/access to display them.
  • Use @shared/access from buildMemberSoleAdminDisabledReasonTextForUsername(kind, adminUsernames) to block removal or demotion of the only Admin of a project, cache or team. Attach the reason to the role select ([disabled] + [grTooltip]) and the Remove button ([disabledReason]).
  • Sort roles with compareRoleNamesByBuiltInAccessThenName. from @shared/access. Built-in View, Write and Admin come first, from lowest to highest access. Custom roles follow by name. The role selector and dialog preselect the first role. New member and team grants start at the lowest access. Team member options list Member before Admin. Role rows display the member count from countMembersByRoleName(members). Keep delete disabled for a member with that role. Use tooltip [grTooltip] for the reason. Server-side checks reject that delete.
  • The Remove member and Revoke invitation dialogs show the person's name at formatMemberNameForConfirmDialog(displayName, username) from @shared/access. One example is "Carol Outsider (carol)". The "Revoke invitation" dialog can read the sentence that states what happens if the user confirms and the failure text from @shared/access/pending-invitation-revoke-dialog-texts.
  • Save member role changes on project, cache, and team pages from @shared/access through injectSaveMemberRoleChangeWithOwnRoleConfirmation(). Ask for confirmation when a signed-in user lowers their own role (with newRoleLacksCurrentRolePermission(roles, current, next) for project and cache roles). Save all other changes at once. The member deletion dialog gets text from getMemberRemovalConsequenceSentence(place, username, signedInUser), Use the second person for signed-in users.
  • Save project and cache settings from @shared/access through injectSaveSettingsWithPrivateToPublicConfirmation(). Saves from private to public open a dialog. The dialog fields are target name, Save access details. Other saves run right away.
  • Show the gr-project-readiness-card of shared/ui/project-readiness on the project page, the empty project state, and step 1 of the repository connection wizard. The card can list rows for Workers, Cache, and Git access from GET /projects/{p}/readiness. Each row can offer only the fixes that viewer permissions allow. Viewers see rows without buttons. The row for Git access can link each failed task to the Repository page of that task (links.taskPage(project, task, 'repository')). Tasks select a connection to a Git host on that page. The waiting banner can reuse the same rows for waiting reasons no_cache, workers, and eval_workers.
  • Show a count from PendingUserDecisionsService ("N requests need a decision") in a requests banner on the dashboard and link the banner to the Requests page. Invitations from GET /user/requests, subscription requests for the cache and grant requests for teams make up the count. Show the same count in the header badge. Render app-pending-invitations-banner from @shared/access at the top of the /projects, /teams and /caches lists. List pages can pass kind (project, team, cache) to count only invitations for that list. A list can show a dedicated empty state when empty, even when public items sit next to the list.
  • Show the Settings button only for roles that can change settings or for roles that can open the Members page. Use canOpenProjectSettings(project) with canOpenProjectMembersPage(project, user), canOpenCacheMembersPage(cache, user) and canOpenTaskSettings(task) of @shared/access in every header that links to the settings page. Hide links to pages that show only 'No access' for that role. Keep links to pages that the role can view.
  • Show scheduler internals only to superusers. Those internals include the score, score breakdown, workers, job and instance context, and the Scheduler tab. The server can leave those fields out of the response for other users. The template must branch on that response field, not on role. Workers whose name the server does not return get the label "Not shared with this account" and no link. The viewer cannot view the project in that case. Never show the worker as a raw UUID.
  • Board rows display the project name and task name from features/board/project-task-links.component.ts through app-board-project-task-links. Show the display name. Link both names. Show a dash if the server doesn't return a project name. Long names truncate to 2 lines. Tooltips show the full name. Use this row in the Assigned, Pending and High Cost rankings. Board lists with more than 50 rows use gr-load-more to show 50 rows at a time.
  • Print every scheduler score with one decimal through schedulerScoreDecimalPipeDigitsFormat from features/board/scoring-rule-label.ts and call the bar of a rule's part of the score "Share" on every page.
  • Validate input on the client with fieldChecks in @shared/forms. Use gr-form-field to show messages below the field before the request can leave the client. Track changes on the settings page with unsavedChanges() from @shared/forms. Keep Save disabled when there are no changes. Register unsavedChangesGuard on the route and ask for confirmation before leaving with edits. The guard lets the page go without asking once the session has ended, because the edits can't be saved anymore.
  • Use warning input of gr-form-field to display checks that don't block saving, such as a flake URL without a commit. Warnings and errors show below the field. Errors replace warnings.
  • Field hint: gr-form-field can show hint as a help icon after the label and can show the hint as a tooltip. Content projected into [slot=hint] can remain visible below the field. Use [slot=hint] only for live values like “Instance limit: 30”.
  • One help icon per label. A label can have a documentation link too. Put the hint in gr-label-help as explanationText. Hover or focus can show the hint. A click can open the documentation.
  • Section descriptions appear as a help icon after the heading. Remove descriptions that only repeat the title.
  • Page subtitle: keep only subtitles that carry state, such as counts or slug. Remove subtitles that repeat the title or describe the page.
  • Empty state: title and action button. Keep the message only for an empty state without an action button. State the conditions for item display in the message.
  • Always show validation errors, warnings, results in danger zones and a status row that has one line in an empty log pane.
  • gr-dialog can display [error] above the footer and outside the scrolling content. A failed write can leave the result next to the button that the user pressed.
  • When the server refuses a form field (for example a 422 about the URL), show its message under that field through gr-form-field, not in the dialog [error]. Keep the message only while the field holds the refused value, so editing the field clears it. Other refusals stay in [error].
  • List rows show up to three common actions as buttons. Webhook rows label these buttons "Test", "Deliveries", and "Edit". Rare destructive actions move to a single gr-menu behind an icon-only more_vert button with name "Actions for ". Examples include secret rotation, disabling, and deletion. Bind [loading] to that button while a menu action is active.
  • Bind (grSubmit) instead of (click) on the submit button of every gr-dialog and gr-settings-section form. It blocks the submit while a gr-form-field in the same section shows an error. Scroll the first field with an error and its error message into view on each click. Put focus on that field. Errors that show only after submit follow the same rule. An error can stay visible and the button can still look enabled. Clicks then lead to the next problem, not to a greyed-out button for no reason. Call injectRevealFirstInvalid() from @shared/forms only on submit paths without that button, such as Enter in a field. Place the save result directly above Save on long settings pages. Scroll the result into view.
  • Show rejections from the server under the field, not in a toast or banner. Keep the error code from the server in ApiError.code. Use apiErrorCodeToFormFieldName from core/services/account-form-api-checks to map username_already_in_use and email_address_already_in_use to form fields. A dialog can map already_exists to the name field. Call injectRevealFirstInvalid() on a rejection to scroll to that field. Keep the message visible until the first edit of that field. Use checkUsernameAvailability() from the same file to check a username at sign-up and during input on the profile page.
  • A stored value can differ from the display text (for example, a team name behind a display name). Pass { label, value } suggestions to gr-autocomplete in that case. The field can show a label and write the value. Users open the list by typing, clicking, or pressing ArrowDown. They select with the arrow keys and Enter. Escape can close the list and leave the surrounding dialog open. Set a gr-form-field label or placeholder on the field. That text can name the list.
  • Build every link in the app with links from @shared/routing. Don't write paths as arrays or strings. The builder output is a UrlTree with query params. Bind that to routerLink only, without queryParams. Navigate through router.navigateByUrl. Pages that tasks or evaluations reach keep that context in the link. Back paths then return to the same evaluation and build. All pages show a gr-breadcrumb trail back to the parent, either through gr-page-layout or alone. Sibling pages such as user settings use gr-link-tabs for links and show tabs instead of a breadcrumb.
  • Sign-in links and sign-up links put the current page into the next query parameter. Links between the sign-in page and sign-up page keep that parameter. Links from registration to sign-in do the same. The page can read the parameter with readInAppNextPathFromRouteSnapshot() from @shared/routing. This function can return null for addresses outside the app. Sign-in doesn't redirect to another site.
  • Link each breadcrumb only to pages that the user can open. Leave the breadcrumb as plain text when the user cannot open a page (task settings when the user cannot access settings).
  • Pages of an evaluation share one breadcrumb (Project > Task > Evaluation). The pages are log, summary, dependency graph of the build, artifacts, and closures. Mark the evaluation as the current page on the log page. Build pages without task or eval in the URL fill both from the build loaded through BreadcrumbsService.buildPage.
  • Pages save a new display name for a project, task, cache, or team. They then call the corresponding remember* method on BreadcrumbsService. The breadcrumbs and the title of the browser tab both read that name, so neither can show the old name.
  • Link to the evaluation log with links.evaluationLog. build only selects a build and never narrows the build list, so a reload or a link from the summary, graph or board shows every build. Pass package only to open one package with its dependencies (the task page package rows do this). While the list is narrowed, the sidebar names the package above the list and offers a button that lists every build again. Never narrow a list without saying so on the page.
  • gr-log-viewer reads the #L line link from the URL itself and jumps to that line each time it changes, also on a page that is already open. Pages don't parse the fragment. A page that rewrites its query parameters before its first log shows sets preserveFragment, so the line link survives.
  • Render the header row of the log itself in the log viewer (gr-log-viewer). Pass the title from the page as an element with the logTitle attribute. Add a line count and a search button to the viewer. Search must stay reachable without Ctrl+F and on touch screens.
  • Show a waiting or stuck state through gr-waiting-notice, never as bare text. Its mapping, explainWaiting in @shared/evaluation, gives each reason a title, a detail and either an action (a link or Run) or a hint whom to ask, chosen by the viewer's permission. Add a new reason there, not on a page.
  • When several items wait at once, render one gr-waiting-notice per item and pass its name and link through subjectLabel and subjectLink, never one notice for the first item.
  • Use buildDurationTextForEvaluation() for package build time and buildStatusToShowInEvaluation() of @shared/evaluation for build status. Both values take an evaluation as an argument. Label a build that an earlier evaluation ran "reused". A build that a newer evaluation continued can show the label Aborted at the end of this evaluation, with the timer stopped. Use abortedWithoutBuildsTitle() as the title for an Aborted evaluation without a build. Show a short reason for the wait on the same line with waitingReasonText(). Logs, the task page, and the list of exec jobs all use the same wording.
  • Count builds in buildTally(). Write the count line to getBuildCountTextPieces() in @shared/evaluation as “N of M built · F failed · D skipped · A aborted”. Show one total only. Don't show a second total. Pass the evaluation status so completed evaluations render unfinished builds as aborted. Task pages, logs and summaries use these terms. Use buildOutcomeLabel() to name DependencyFailed “Skipped: Dependency failure” everywhere.
  • Use gr-live-status on every page that receives socket updates to show connection state. On task pages, show the badge only during socket reconnect. A connected badge there can look like task status. Build the onLiveSocketConnectedChange callback of LiveService.connect with createResyncOnLiveSocketReconnectCallback(resync, onConnectedChange) from @core/services/live.service. The callback can reload page data on each reconnect and feed data to the badge through onConnectedChange. These reloads leave no stale counters or missing evaluations from events that were missed while the socket was down. Don't write separate reconnect checks on the page.
  • Use buildStatusLabel() from @shared/evaluation to display build status. Never show raw API values such as FailedPermanent.
  • Strip terminal's color codes with removeAnsiEscapeSequences(), imported from @shared/log, before evaluator or build output can appear in tooltips or error lines outside the log viewer.
  • Event names via eventNameToReadableText() of @core/models, never dotted like build.failed_transient. Server error chains in table cells via getLastErrorCause() of @shared/text. Put full text in title.
  • Link sibling pages of one area, such as the user settings, with gr-link-tabs in the page banner slot, so every page reaches its siblings in one click.
  • Show repository fetch failures in app-repository-fetch-banner of @shared/git. Members who can edit the task see the git error and how to fix the failure. Everyone else sees who to ask.
  • Use app-incoming-deliveries from @shared/git to show the webhooks that the Git host sent on the connection to the Git host. Rows include the event, result and rejection reason.
  • Show outgoing deliveries of event notifications and task actions in app-outgoing-webhook-delivery-list-dialog of @shared/outgoing-deliveries. A click on a row shows the error, request body and response body. Rows wrap on narrow screens. Show the short result of a delivery with getDeliveryResultReason(): the HTTP status or the last cause of the error.
  • Keep the initial bundle below the 500 kB budget. Load shell parts not needed for first render (dialogs, command palette, menus built on @angular/cdk/overlay) inside a @defer (on idle) block. Import lazy components from their own file, not from a barrel such as @shared/confirm. Imports from a barrel keep the component in the initial bundle. Triggers inside the shell store clicks that happen before the lazy code has loaded (see the user menu in the header). Those triggers replay the clicks after the block has rendered.
  • Sections with their own guard, such as the job board, keep their routes in the <feature>.routes.ts file. Load them from app.routes.ts with loadChildren. The guard and the services that come with it stay out of the initial bundle.
  • Put the repository URL, the access check, the picker for Git host connection and the switch for Report commit status on the repository page of a task. Edit the triggers for push and pull request only on the triggers page. Two features belong to the connection. The UI labels for the two features are "receives events" and "reports status".
  • Use at most one primary button per view or section. A primary button can be the main action in a page header, the submit button in a form or dialog, or an empty-state action. Use secondary for section header actions, row actions, and all other actions. Assign the same severity to equivalent actions. Use danger for all destructive actions, namely delete, revoke, remove, abort, deny, disconnect. Keep secondary for disable, enable, deactivate and activate. These actions are reversible. Keep secondary for declining an invitation because it deletes nothing. Use the pause and play_arrow icons for deactivate and activate. Only these three severities exist under button[grButton]. Disabled buttons keep the fill for their severity at half opacity, so even a disabled primary button can still read as the primary action next to an enabled Cancel. Tests in contrast.spec.ts check the primary fill on a page at 3:1.
  • Set disabledReason on button[grButton] for a button that the user can't use yet. One example is "Evaluation is already queued". The button can stay focusable and block clicks. The button can show the reason as a tooltip on hover and focus. The same button can announce the reason to screen readers through aria-describedby. [grTooltip] on the same button can display the reason when set. Use native disabled only for buttons that are temporarily blocked. Common cases are an invalid form or a request in progress.
  • Set disabledReason on a gr-menu item that the user can't use yet, the same way as on button[grButton]. The item stays focusable and in the arrow key order, ignores clicks and shows the reason below its label on hover and focus. Screen readers announce the reason through aria-describedby. Use disabled only for entries that have no reason. Take the reason for build entries (Closure, Artefacts, SBOM, Download Log, Show job) from the get*MenuItemDisabledReason function in @shared/evaluation. Use the same wording on the evaluation log, the task page and the metrics page.
  • Empty text and a pointer exit from a disabled host both hide [grTooltip]. To remove the tooltip, bind an empty string. Don't wrap the directive in another condition.
  • Wrap the link to the list with withCreateDialogQueryParam() from @shared/forms for the create dialog on a list page (projects, teams, caches). List pages call openCreateDialogFromUrlIfAllowed(canCreate, open) in the constructor. Open the dialog only for users who can create. Remove the parameter from the URL. Back navigation and reload do not open the dialog again.
  • Show the create action once per view. Put it only in the empty state with an empty list, and in the page header once items appear.
  • Row actions have visible labels (Edit, Remove, Revoke, Delete). Keep the aria-label for the target. Use icon-only buttons only in table cells, toolbars, and zoom controls when the label doesn't fit. Buttons in the same row have the same size.
  • Set the content width of a page with the width input of gr-page-layout. Don't set a fixed width on sections. Use form (720px) for creation flows, settings (880px) for all settings pages and their sibling pages, detail (1200px) for overviews and lists, and full for graphs and logs. Pages without gr-page-layout use the same $content-width-* variables. Button labels don't wrap. Wrap the button row with .gr-form-actions instead.
  • The header menu can fill the full height below the header on narrow screens and use the font size of body text. A one-line row meta, such as a commit and its elapsed time, can cut off with an ellipsis and not wrap to a second line.
  • Fit the graph canvas to the content on load. Small graphs fill the view rather than a small patch in blank space. Set legend text to 14px and color swatches to 12px.
  • Mark the active tab of gr-link-tabs and every other tab row with a --gr-accent underline. Put badges on the name line of a row and separate the parts of the meta line with " · ". Don't nest a gr-row-list inside a card. Each row is already its own card, so set [card]="false" on the section around it.
  • Use gr-link-tabs for every tab row on a page, including the job board. Add the global gr-scroll-fade-row class to every row that scrolls sideways, such as tab rows and card strips. It fades the row only on the side where more items are hidden. Keep the active tab in view. Use gr-row on narrow screens to move labeled buttons and selects to a separate line below the name, so the name can keep full width. The info bar on the log page can wrap to multiple lines instead of a horizontal scroll. Stat cards align values to the top. Values on the same row line up even with a label on multiple lines.
  • Treat duration as runtime. Format duration with formatDuration() from @shared/text. Measure an evaluation from the first fetch (evaluationDuration()). Measure a build from the start of an attempt (buildDuration()). Both are @shared/evaluation. Never count queue time as duration. Table cells display "-" for a job or evaluation that didn't start. Page headers (evaluation log, summary) leave the duration out until the evaluation starts.
  • Show the build count from buildTally() inside @shared/evaluation as done / total builds. Place that label next to gr-segmented-bar, which shows the same counts. Count completed, failed and cancelled builds as done. Dependency-failed builds count as cancelled. Count substituted builds only in the overall total. Don't add a second build counter with a different meaning. Running builds take the striped section of the bar, so the solid section and the completed count in the label line up.
  • Show API timestamps in one format, "Nov 8, 2026, 11:38" in local time on a 24 hour clock, through the serverDate pipe (or dateTimeText() in code) from @shared/text. The pipe takes no format argument. Show elapsed time ("5m ago") in row meta lines and stat cards with the relativeTime pipe, and put the full date in title. Chart axes use clockTime(), monthDay() or monthDayClockTime(). Never use Angular's date pipe, toLocaleString() or new Date() on API timestamps: they arrive as UTC without a zone. Never call Date.now() in a template binding: read CurrentTimeSignal, which ticks once a second, so a relative time or a running duration keeps one value through a change detection pass.

Shared UI Package

The package @gradient/ui lives in the pnpm workspace at frontend/packages/ui. Two consumers build on it: Gradient itself and the frontend of gradient-proxy for servers.gradient.ci.

Entry Content
@gradient/ui/ui Generic primitives, listed under gr-ui
@gradient/ui/chrome gr-header and gr-footer, configured through brand, nav and footer link inputs plus a [slot=lang]
@gradient/ui/tokens Colour tokens from tokens.ts
@gradient/ui/styles/* SCSS partials variables, themes, grids and the global base styles
  • The package must stay free of imports from @core, @shared or @features. Only primitives without such imports belong there.
  • An ESLint rule blocks these imports in packages/ui code.
  • pnpm tokens:generate and pnpm tokens:check delegate their work to the package.
  • ng test runs the package specs as well.
  • The gradient-proxy frontend can link the package with link:../../frontend/packages/ui.

gr-ui

The generic building blocks live in frontend/packages/ui/src/ui/ and build on @angular/cdk. Gradient-specific components (gr-eval-status-badge, gr-status-icon, gr-waiting-notice, gr-live-status, gr-metric-chart, gr-star-button, gr-label-help, gr-entity-name) live in frontend/src/app/shared/ui/. Imports go through the barrel of each layer.

import { FormFieldComponent, PageLayoutComponent, SettingsSectionComponent } from '@gradient/ui/ui';
import { MetricChartComponent } from '@shared/ui';
Group Selectors
Actions button[grButton], a[grButton], gr-star-button, gr-menu
Forms gr-form-field, input[grInput], textarea[grInput], select[grInput], gr-password-input, gr-name-field, gr-select, gr-select-button, gr-checkbox, gr-autocomplete, gr-label-help, gr-label-explanation-button
Display gr-badge, gr-eval-status-badge, gr-status-icon, gr-icon, gr-logo, gr-copy-field, gr-field-row, gr-stat-card, gr-metric-chart, gr-table, gr-divider
Feedback gr-message-banner, gr-toast (with MessageService), gr-loading-spinner, gr-empty-state, gr-load-state, gr-load-more
Overlays gr-dialog, gr-popover, [grTooltip]
Layout gr-page-layout, gr-breadcrumb, gr-link-tabs, gr-settings-section, gr-row-list / gr-row, gr-card-grid, gr-nav-card, gr-tab-switch, [grInView], [grScrollRegion], [grDrawer]
  • gr-page-layout: a header with title and subtitle, a breadcrumb, optional [slot=actions] buttons and an optional [slot=banner], then the content. Actions move to a dedicated row below the title on smartphones. Labels stay unchanged. The current breadcrumb item and the title of gr-nav-card shorten long names with an ellipsis. A tooltip shows the full name.
  • gr-settings-section: A section with a title. An optional description can appear as a help icon after the heading. The default is a card around the section. Set [card]="false" to remove the card.
  • gr-load-state: a wrapper for any content that can load its own data. The inputs loading, error and empty pick one of four states (a spinner, an error with a Try Again button, an empty state, or content). Errors always take precedence over the empty state. A failed request can never show the "nothing here yet" text. 403 or 404 responses show the inaccessible state without Retry. Keep the data visible on reload. Skip the spinner with data on screen. Put write errors (save, delete) outside error. Those errors belong next to the failed action.
  • Board tabs load requests through firstLoad(). Board tabs can show an error state only when no requests in a load round respond. Some requests respond. Board tabs keep the content that did load and show the failure with a toast. Tabs with independent panels (Assigned and Pending in Live Jobs) give each panel its own firstLoad(). Keep panel switching outside load state. A failure in one panel can never remove the other panel from view.
  • Mark main with aria-busy in the app shell if route guards, resolvers, or page code wait longer than 300 ms during navigation. Also show a "Loading page..." spinner on the first page of a visit. Don't add another loading state to a page for a route guard or resolver.
  • Pickers with an empty list need another item (a cache, a team, a connection to a Git host). Show the next step in the .gr-form-aside row below the field. Users who can create that item get the create dialog in place. Reopen the original dialog with the new item selected after creation. Links to the page for that item cover the other case. Don't show the create option to users who can't create. injectCanCreateCache() and injectCanCreateTeam() hold that check inside @shared/forms.
  • Server-paginated lists (projects, tasks, caches) use pagedList() from @shared/paging and end with gr-load-more. Lists keep items on screen and add the next page. Show a toast on a failed page load. Keep the list.
  • Keep lists that other users change (tasks, caches, members, subscription requests) current with runReloadIntervalWhileTabVisible() from @shared/paging. Pass pagedList().refreshFirstPageSilently() or a fetch that sets the signal. The helper skips hidden tabs, reloads when the tab shows again and keeps the shown items when a reload fails. Pages with a socket use gr-live-status instead. Pages built from sections that each load their own data call the helper once. They merge the silent reload of each rendered section, as on the dashboard.

Grid Utilities

frontend/packages/ui/src/styles/_grids.scss, registered globally in src/styles.scss.

Class Layout
.gr-grid-stats Auto-fit grid of stat cards, 220px minimum
.gr-grid-form Two-column form, one column below $breakpoint-md. .gr-grid-form__full will span both
.gr-grid-cards Auto-fill grid of cards, 280px minimum
.gr-grid-rows Label, value, actions rows
.gr-form-aside Auxiliary row below form fields. Prompt for the next action (e.g. create a missing item).
.gr-form-actions Row of form buttons. --end will align right
  • Contributing covers the rules for dependencies and lockfiles.