@ebitex/starter-kit-react
v1.0.347
Published
A React renderer for the ebitex starter kit: the kit's sections, themes, appearances and Assets media, drawn with Tailwind tokens you can override one at a time, or take over completely.
Maintainers
Readme
@ebitex/starter-kit-react
A React renderer for the ebitex starter kit: the kit's Templates, an experience's theme, a section's appearance, and Assets media, drawn with Tailwind tokens. It is meant to get a site on screen quickly and then be taken over, a piece at a time: replace one Template's renderer, add a Template of your own, change a token, replace the links, or copy the source into your project and drop the dependency.
It renders presentations. The kit's experience holds a hero and sections that are presentation fields: each is a Template, that Template's settings (width, background, appearance, emphasis, columns, how an accordion behaves...) and a Component holding only editorial content. The renderer is chosen by Template, never by the Contract it draws, so two Templates may present the same Contract in different ways.
Guide: Start a client site from the starter kit. Reference: developers.ebitex.io/reference/starter-kit-react.
Use it
import { ContentProvider, Experience } from '@ebitex/content-sdk/react'
import { EbitexMarkdown, EbitexProvider, ebitexRenderers } from '@ebitex/starter-kit-react/react'
<EbitexProvider client={content}>
<ContentProvider client={content} renderers={ebitexRenderers()} markdown={EbitexMarkdown}>
<Experience path={pathname} />
</ContentProvider>
</EbitexProvider>@import "tailwindcss";
@import "@ebitex/starter-kit-react/styles.css";
@source "../node_modules/@ebitex/starter-kit-react/dist";The site header and footer
A kit 1.1 organization has a Site chrome Component (external id ebitex-site-chrome) holding two presentations, a header and a footer. Publish it like any other content and the experience draws
them around every page. They are fetched with the content client you give EbitexProvider (client), once per session; a half that is not published, not reachable or not valid draws nothing, and a
site with no chrome is drawn exactly as before. To draw them yourself, outside your routes, use <SiteHeader /> and <SiteFooter /> (the experience notices and does not draw a second pair), or
useSiteChrome() for the two presentations. Replace either by registering your own renderer for ebitex-site-header-template or ebitex-site-footer-template; chrome={false} on the provider turns
the experience's own off. The header's sticky, appearance and logo-size and the footer's appearance are the Templates' settings.
A host that registers its own renderer for the header can fill its end slot: (props) => <SiteHeaderTemplate {...props} end={<Cart />} />. The node is drawn first in the right-hand cluster, before the action and the menu button, and stays visible at every width (a cart does not fold into the small-screen menu). Without end the header is the same markup as before.
EbitexMarkdown needs the optional peers react-markdown and remark-gfm; use your own markdown component instead to avoid them.
Take it over, a piece at a time
| To change | Do |
|---|---|
| How one Template draws | Replace its entry: <ContentProvider renderers={{ ...ebitexRenderers(), 'ebitex-card-template': MyCard }}>. The component receives the SDK's { template, settings, component }: the Template's choices in settings, the Contract's editorial fields in component.content |
| A Template of your own (a new Contract, or a second way to present a kit Contract) | Register it beside the kit's in the same map. Draw inside Frame (<Frame settings={settings}>) to get the Template's width, background, anchor and appearance, and to join the appearance cascade. A Template with no renderer shows the host's ContentProvider fallback and never breaks the page |
| How links navigate | <EbitexProvider link={RouterLink}>; the default is a plain <a> |
| A colour, a theme or an appearance | Redefine the --ebitex-* tokens, or copy a theme or appearance block from styles.css and edit it. A brand is five tokens (surface, ink, accent, accent-ink, line); --ebitex-font-display sets the face of the headings the kit draws |
| Everything | npx starter-kit-eject src/kit copies the components, tokens and vocabulary into your project and never overwrites a file; delete the dependency afterwards |
Groups and icons
A Group is a section with an optional eyebrow and heading over any number of presentations. Its Template's settings add spacing (compact, standard, spacious) and align (start, centered) to the
section settings; an appearance on the Group reaches what it holds, and a presentation inside can choose its own. A Feature's symbol (a category of the kit's ebitex-icon group; a Feature from an older kit has a free-text icon instead, drawn when no symbol is chosen) names one of the kit's line icons (billiards, target, beer, bolt,
puzzle, palette, star, check, heart, clock, pin, phone, mail, shield, users, trophy, drawn by Icon in the accent colour); any other text, an emoji say, is drawn as it is.
Appearance cascades
A presentation's appearance setting is a category: inherit (or nothing) means the parent's, anything else is its own. Frame writes data-ebitex-appearance for a
chosen appearance, so the token overrides in styles.css reach everything inside it, and provides it through context (useAppearance()) so a nested presentation, such
as a card in a grid in a section, sees the appearance in force. A nested presentation that chooses its own overrides it for its own subtree.
Categories
Every closed choice in the kit is a category (theme, appearance, layout, width, background, aspect ratio, emphasis, tone, action
style). The Delivery API sends a category as a descriptor with its path (ebitex-width/wide), so the renderer owns the mapping:
keyOf, pick and pickOptional (exported from the package root, with no React) read the key and fall back to a default for one they
do not know, so a category you add draws as the default until you teach the renderer about it.
