> ## Documentation Index
> Fetch the complete documentation index at: https://juo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Blocks

> Build type-safe, schema-driven subscription UI components — composable in any storefront.

`@juo/blocks` is a library for building **self-contained UI components** — blocks — that present and manipulate subscription data. Each block has props and slots described by a type-safe schema — familiar anatomy from Vue, React, or Preact components.

Blocks consume domain **services** (subscriptions, customers, orders, products…) through type-safe contexts and can be composed into pages. The library is framework-agnostic at its core — renderers are plain functions, and thin adapters add idiomatic ergonomics for Vue, React, and Preact when needed. Wrap any block in a web component to mount it from HTML.

## What the library provides

<CardGroup cols={2}>
  <Card title="Blocks" href="/docs/blocks/concepts/blocks">
    Self-contained UI components with typed props and slots described by a JSON Schema. Familiar anatomy, framework-agnostic renderer.
  </Card>

  <Card title="Reactivity" href="/docs/blocks/concepts/reactivity">
    Signal-based reactive state that remains synchronized across framework adapters, including Vue refs, React state, and Preact hooks.
  </Card>

  <Card title="Contexts" href="/docs/blocks/concepts/contexts">
    Type-safe dependency injection over the DOM. Provide services once at the root; override on any sub-tree; any block can request them.
  </Card>

  <Card title="Services" href="/docs/blocks/concepts/services">
    Domain APIs — subscriptions, customers, orders, products, schedules, auth, routing, workflows.
  </Card>

  <Card title="Editor" href="/docs/blocks/concepts/editor">
    Connect a portal to the Juo Editor so operators can configure, theme, and translate blocks without code.
  </Card>

  <Card title="Localization" href="/docs/blocks/concepts/localization">
    Translate copy alongside content, with overrides flowing through the same context tree as services.
  </Card>
</CardGroup>

## Composition model

A **page** is represented as a root block. Blocks expose **slots** through their schema, and slots contain child blocks. This creates a recursive tree in which each block can define its own structure and dependencies.

<img src="https://mintcdn.com/juo/DmI4hy9S0Wn-6Yem/docs/blocks/images/overview-composition.svg?fit=max&auto=format&n=DmI4hy9S0Wn-6Yem&q=85&s=7c048f761d13bcf2df1da5afc801259e" alt="A cyan juo-page route='/' frame containing two side-by-side amber juo-extension-root frames — 'aside' on the left with a purple juo-block Menu showing five icon-and-label rows, and 'main' on the right stacking a purple juo-block SubscriptionList with placeholder list rows above a purple juo-block Upsell rendering a thumbnail, two pitch lines, and an 'Add' button." width="800" height="420" data-path="docs/blocks/images/overview-composition.svg" />

Each block is authored in isolation — its props, its slots, and the [services](/docs/blocks/concepts/services) it consumes. Routing, mounting, and composition are handled by the host portal.

## Framework adapters

Concept examples use the plain DOM renderer. Framework adapters provide native integration patterns, including `useContext`, `useSignal`, and framework-native components, while preserving the same registry, context tree, and signal-based reactivity model.

<CardGroup cols={3}>
  <Card title="Vue" href="/docs/blocks/frameworks/vue">
    Vue components as renderers, Composition API composables, and signal-as-ref interop.
  </Card>

  <Card title="React" href="/docs/blocks/frameworks/react">
    Components and hooks, `useSignal` for reactive reads.
  </Card>

  <Card title="Preact" href="/docs/blocks/frameworks/preact">
    Same surface as React with Preact's hooks runtime.
  </Card>
</CardGroup>

Use `create-juo` to scaffold a blocks package. The [custom portal guide](/docs/blocks/guides/custom-portal) covers installation, entry points, and host application mounting.
