Skip to content
checkfuPublic

About

UI kit built on Effect UI and StyleX

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

UiContext

Components for Effect UI and StyleX. Install an item to copy its editable source into your app. The catalog includes native controls, application layouts, record views, editors, and agent interfaces.

Install

Run the commands from your app.

npx shadcn@latest list checkfu/uicontext
npx shadcn@latest add checkfu/uicontext/form-controls
npx shadcn@latest add checkfu/uicontext/app-shell

Use checkfu/uicontext/all to install the full kit. You can append # and a commit SHA to an item address to pin the source. Each item contains the local files it imports, so pinning an item also pins its source dependencies. This includes the MIT license.

Components install under src/ui/uicontext/components/. The original button item keeps its path at src/ui/uicontext/button.ts and its variant and size API. The button-family item supplies the kit’s themed Button and Toggle.

The compact-dashboard item includes native Effect UI controls, tables, and description lists under components/compact-dashboard/. Its StyleX tokens and recipes match Checkfu’s dashboard density and can be shared across renderers during a migration.

Blocks

The Blocks gallery includes working starters for an issue tracker, automation builder, database workspace, coding agent workspace, and personal assistant. Each starter installs the screens, editable sample data, and the components they use. Mount the starter in an Effect UI route and connect its update handlers and Effect commands to your app's services.

npx shadcn@latest add checkfu/uicontext/issue-tracker
npx shadcn@latest add checkfu/uicontext/automation-builder
npx shadcn@latest add checkfu/uicontext/tables
npx shadcn@latest add checkfu/uicontext/coding-agent-workspace
npx shadcn@latest add checkfu/uicontext/personal-assistant

App setup

  • Set TypeScript’s strict and exactOptionalPropertyTypes options and include ES2023 or later and DOM in the TypeScript library types. UiContext uses the Effect UI snapshot pinned in package.json and the matching upstream guide.
  • Configure your StyleX build integration. With Vite, import a base CSS file from your app entry point so generated rules have a stylesheet.
  • Set color-scheme: light dark on the app root to follow the device setting. Apply a theme from the themes item to customize a subtree.

Bun projects installing items that use @effect/ui-kit need this entry in their root package.json overrides before running add. Bun otherwise tries to resolve the preview’s peer dependency on npm.

The registry pins a Menu Escape backport built from the 9d672ab UI Kit snapshot. The release provides the exact package and source patch. UI Kit backport

{
  "overrides": {
    "@effect/ui": "https://pkg.pr.new/Effect-TS/ui/@effect/ui@9d672ab"
  }
}

Compose native controls

import { FormField, Input } from "./ui/uicontext/components/FormControls.ts"

FormField(h, {
  id: "project-name",
  label: "Project Name",
  description: "Choose a name your team will recognize.",
}, (attrs) =>
  Input(h).attrs({ ...attrs, name: "project", autocomplete: "organization", required: "" }),
)

Use data-table for a semantic, read-only collection and table for an interactive, virtualized record grid. Route queries, mutations, and permissions live in the app's Effect UI services. For WebMCP, install agent-tools and provide an explicit action allow list in your app.

Use tabs for panels within a page and route-nav for destinations with their own URLs. Tabs support separate kept-mounted panels for editors and a shared panel for views that update one grid. When updating a copied item, review its dependency files alongside the changes and keep your app’s token values where it customizes the theme.

Edit and comment outcomes carry the same request string emitted by the component. Keep that string verbatim when replying, including when several views share the same outcome list.

Follow a conversation

Wrap a chronological transcript in ConversationViewport using its content slot. Give the region an accessible label and set maxHeight in CSS pixels or size it from a constrained parent. Keep the composer outside the scroll region. New replies stay in view until the reader scrolls up. Scrolling back to the bottom or choosing Jump to latest resumes following. Conversation example

Own editor state

Store Editor's Changed.blocks immediately and persist asynchronously. Changed blocks props are authoritative in the default mode.

To apply responses that can arrive out of order, provide sync: { revision: 0 } from the first mount. Store each native edit's Changed.change token with its blocks and pass it back as sync.acknowledged. Apply a save response only if its revision, session, and sequence still match that token. The current response can supply normalized blocks with the same acknowledgement.

Increment sync.revision and clear the acknowledgement for restores, component edits without a token, and remounts. Keep the revision in the parent across remounts and advance it before creating the new editor. A revision change also lets the parent restore the same block values. Editor reducer example

Save memory corrections and confirm resets

Pass correctionOutcome: null to keep the MemoryViewer editor open while the app saves. Put the displayed record's opaque revision in entries[].revision. The viewer captures it when the editor opens and returns it as RequestedCorrect.baseRevision beside a unique request. Use the base revision in the app's write. Return { request, refused: null } when the saved entry is ready to display, or { request, refused: "…" } to keep the draft and show the refusal.

Keep the viewer mounted while paging within the same memory scope. The correction draft and its base revision stay with the original entry. When that entry leaves the view, the person can return to it or cancel the draft from the current page.

When reset affects more than the loaded rows, pass resetScope: { count }, resetScope: { description }, or both. Use the authoritative number of remembered entries affected or a description of what the last confirmation removes. The agent confirms the same scope. Memory viewer example

Protect invitation and webhook credentials

Use arrivalOf for claim and invitation routes. It accepts raw codes and returns an Arrival with redacted codes. In an Effect UI route, define the query field as Schema.optional(Schema.RedactedFromValue(Schema.String)) so it is already protected in the parent route, model, and messages.

Wrap bearer values with Redacted.make(value) before putting them in Members.invitation, Share.invite.url, or RoutineCard.webhook.secret. Use Schema.Redacted(Schema.String) for those same values in the parent’s props, models, and command results. Reveal the string only at an intentional display, clipboard, or HTTP boundary. Ordinary object links and webhook addresses use string fields.

This covers Effect UI’s serialized message log. The app also controls URL history, HTTP logs, and any other telemetry.

Agent IDs across surfaces

ArtifactCard defaults its agentId to artifact:${id}. ArtifactViewer defaults to artifact-viewer:${id}. When two instances share an agent registry and can mount at the same time, including during navigation, give each instance a stable, distinct agentId. For example, two cards for the same file can use artifact:task:${id} and artifact:make:${id}. Keep id as the artifact's identifier in your app.

Schedule previews

Set RoutineCard.requirePreview to true when the app checks a schedule before saving it. In the RequestedPreview handler, use the supplied text and timeZone to calculate the preview. Pass the original text and request back in preview along with nextRuns and any parsed description or error. Publish one outcome per request and keep it available until the card receives it. Save stays disabled until the current request succeeds. Late replies for earlier requests leave the accepted preview in place.

Agent action inputs

Call page_snapshot for component IDs and actions, then call page_query with id and action to inspect that action’s input schema before using page_act.

A named task with targetAcknowledgement: "explicit" takes { input, target }. The task definition's target routes the action, and the caller's target acknowledges the state the action applies to.

Develop

bun install --frozen-lockfile
bun run dev
bun run typecheck
bun run test
bun run build

Run bun run test:browser with Playwright Chromium installed. Set CHROME_PATH to use an existing headless Chrome binary.

Run bun run test:consumer to install representative built registry items into fresh temporary apps, typecheck and build them, and exercise them in Chromium. --negative-control checks that the smoke catches missing source and CSS. Use --keep to retain a fixture for debugging or --report <path> for a JSON report.

See consumer verification for the corresponding Examples and Checkfu journeys.

To check your own fixture, pass --template <directory> --items <comma-separated item names>. The fixture should include a Vite app, a registry configuration, a strict TypeScript config, and a smoke.mjs that exports async run({ page, baseURL }). Throw on failure and return { journeys: [{ name, passed: true }] } on success.

Edit the corresponding source under src/ and refresh the catalog with bun run registry:generate when an item or its source dependencies change. The build generates the registry under www/public/r/ and includes it in the website at www/dist/r/. To try a built item from a separate app, pass its absolute JSON path to shadcn add.

Edit theme values in tokens/source.ts and run bun run tokens to regenerate the StyleX files and the design-token exports in tokens/dist/.

Deploy the website

vite build www prerenders every page listed in www/src/pages.ts to static HTML through www/src/entry.server.ts, writes 404.html, sitemap.xml and robots.txt, and the browser app hydrates each page in place (www/src/entry.ts). Page markup must not depend on the reader’s appearance: style light and dark with CSS keyed off html[data-appearance], which the head script in www/index.html sets before the first paint. Add a page's path to allPaths when you add a route. Pages serves 404.html with a 404 status for unknown paths. Redraw the social card and icons with bun scripts/og-image.ts.

The Verify workflow deploys the verified www/dist artifact from main to the uicontext Pages project. Its GitHub production environment needs a CLOUDFLARE_ACCOUNT_ID variable and a CLOUDFLARE_API_TOKEN secret with Cloudflare Pages Edit permission for the production account.

For a manual deploy, run the same verification suite from main and upload the result with Wrangler. Install Playwright Chromium (bunx playwright install chromium) or set CHROME_PATH to an existing Chrome binary.

bun run verify
npx wrangler@4.169.1 pages deploy www/dist --project-name uicontext --branch main

About

UI kit built on Effect UI and StyleX

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages