Color mode

UI primitives

@riebeckite/honox/ui is deliberately a small structural contract, not a component framework. Its complete public component surface is:

  • Article, ArticleLayout, ArticleHeader, ArticleContent, ArticleBody, PageBody, ArticleMeta, ArticleFooter, and ContentSlot for an article page;
  • Sidebar for complementary content.

The corresponding *Props types are public. ContentSlot is paired with the pure hasSlot(slots, name) helper, and the ARTICLE_SLOT constant provides the standard slot names.

Stable styling hooks

Each primitive exposes one class as its stable styling hook:

Component Class
Article rb-article
ArticleLayout rb-article-layout
ArticleHeader rb-article-header
ArticleContent rb-article-body
ArticleBody rb-article-content
ArticleMeta rb-article-meta
ArticleFooter rb-article-footer
Sidebar rb-sidebar

These stable styling hooks are the only classes supplied by the contract. Primitives provide semantic HTML, those hooks, class/className composition, and the structural CSS that makes the hooks work. That structural CSS ships in @riebeckite/honox/style.css and reaches the site through the generated .riebeckite/framework-styles.css. Primitives do not own article copy, metadata formatting, navigation placement, cards, page-layout composition, islands, or site visual design and overrides. Those belong to the site application. ArticleHeader and ArticleContent accept either children or their HTML input prop, never both. ArticleBody renders rendered Markdown as .rb-article-content, and Markdown typography is scoped to that wrapper, so plugin components keep their own headings wherever they are placed. ContentSlot looks a slot up by name in the slots map and renders it with a data-slot attribute; a missing, empty, or whitespace-only slot renders nothing, and class/className add site classes. It never infers a semantic element from the slot name.

tsx
import {
  Article,
  ArticleBody,
  ArticleContent,
  ArticleLayout,
  ContentSlot,
} from "@riebeckite/honox/ui";
 
<Article class="site-article">
  <ArticleLayout>
    <ContentSlot
      slots={bodySlots}
      name="article.aside"
      class="site-article__aside"
    />
    <ArticleContent>
      <ContentSlot slots={bodySlots} name="article.header" />
      <ContentSlot slots={bodySlots} name="article.metadata" />
      <ArticleBody html={post.html ?? ""} />
    </ArticleContent>
  </ArticleLayout>
</Article>;

Use the primitives as composition points, then style them from the site. Pass rendered Markdown to ArticleBody; ArticleContent html={...} remains for backward compatibility but is deprecated. Do not import files below @riebeckite/honox/src/ or rely on any unlisted component.

History

1 changesCollapseExpand
1 + ---
2 + title: UI primitives
3 + sidebar:
4 + label: UI primitives
5 + order: 10
6 + ---
7 +
8 + # UI primitives
9 +
10 + `@riebeckite/honox/ui` is deliberately a small structural contract, not a
11 + component framework. Its complete public component surface is:
12 +
13 + - `Article`, `ArticleLayout`, `ArticleHeader`, `ArticleContent`,
14 + `ArticleBody`, `PageBody`, `ArticleMeta`, `ArticleFooter`, and `ContentSlot`
15 + for an article page;
16 + - `Sidebar` for complementary content.
17 +
18 + The corresponding `*Props` types are public. `ContentSlot` is paired with the
19 + pure `hasSlot(slots, name)` helper, and the `ARTICLE_SLOT` constant provides
20 + the standard slot names.
21 +
22 + ## Stable styling hooks
23 +
24 + Each primitive exposes one class as its stable styling hook:
25 +
26 + | Component | Class |
27 + | --- | --- |
28 + | `Article` | `rb-article` |
29 + | `ArticleLayout` | `rb-article-layout` |
30 + | `ArticleHeader` | `rb-article-header` |
31 + | `ArticleContent` | `rb-article-body` |
32 + | `ArticleBody` | `rb-article-content` |
33 + | `ArticleMeta` | `rb-article-meta` |
34 + | `ArticleFooter` | `rb-article-footer` |
35 + | `Sidebar` | `rb-sidebar` |
36 +
37 + These stable styling hooks are the only classes supplied by the contract.
38 + Primitives provide semantic
39 + HTML, those hooks, `class`/`className` composition, and the structural CSS that
40 + makes the hooks work. That structural CSS ships in `@riebeckite/honox/style.css`
41 + and reaches the site through the generated `.riebeckite/framework-styles.css`.
42 + Primitives do not own article copy, metadata formatting, navigation placement,
43 + cards, page-layout composition, islands, or site visual design and overrides.
44 + Those belong to the site application. `ArticleHeader` and `ArticleContent`
45 + accept either children or their HTML input prop, never both. `ArticleBody`
46 + renders rendered Markdown as `.rb-article-content`, and Markdown typography is
47 + scoped to that wrapper, so plugin components keep their own headings wherever
48 + they are placed. `ContentSlot` looks a slot up by name in the `slots` map and
49 + renders it with a `data-slot` attribute; a missing, empty, or whitespace-only
50 + slot renders nothing, and `class`/`className` add site classes. It never infers
51 + a semantic element from the slot name.
52 +
53 + ```tsx
54 + import {
55 + Article,
56 + ArticleBody,
57 + ArticleContent,
58 + ArticleLayout,
59 + ContentSlot,
60 + } from "@riebeckite/honox/ui";
61 +
62 + <Article class="site-article">
63 + <ArticleLayout>
64 + <ContentSlot
65 + slots={bodySlots}
66 + name="article.aside"
67 + class="site-article__aside"
68 + />
69 + <ArticleContent>
70 + <ContentSlot slots={bodySlots} name="article.header" />
71 + <ContentSlot slots={bodySlots} name="article.metadata" />
72 + <ArticleBody html={post.html ?? ""} />
73 + </ArticleContent>
74 + </ArticleLayout>
75 + </Article>;
76 + ```
77 +
78 + Use the primitives as composition points, then style them from the site. Pass
79 + rendered Markdown to `ArticleBody`; `ArticleContent html={...}` remains for
80 + backward compatibility but is deprecated. Do not import files below
81 + `@riebeckite/honox/src/` or rely on any unlisted component.
82 +