Skip to content

Component vocabulary

TL;DR. This is the foundational vocabulary that ships with the framework. Every entry has a native renderer on web, iOS, and Android, plus a server-side HTML mapping so the WebFrame fallback is never empty.

The framework registers these via wun.foundation.components. Each has a native renderer in wun-web, wun-ios, and wun-android, plus a server-side HTML mapping for WebFrame fallback.

keywordrole
:wun/StackVertical or horizontal flex container. Props: :direction :gap :padding.
:wun/TextBody text with variants :h1 :h2 :body.
:wun/HeadingSemantic heading. :level 1-4.
:wun/ButtonTap target. :on-press {:intent :ns/name :params {…}}.
:wun/LinkHyperlink-styled tap target with optional :href + :on-press.
:wun/SwitchToggle. :value boolean, :on-toggle <intent-ref>.
:wun/InputSingle-line text input. :value :placeholder :on-change.
:wun/Image:src URL, :alt, :size pixels.
:wun/AvatarCircle with image or initials. :src :initials :size.
:wun/CardPadded panel with optional :title.
:wun/BadgeInline pill. :tone :info/:success/:warning/:danger.
:wun/DividerHorizontal rule. :thickness px.
:wun/SpacerEmpty space. :size px.
:wun/ListList container.
:wun/ScrollViewScrollable region. :direction :vertical/:horizontal.
:wun/SkeletonLoading-state placeholder. :width :height (CSS values).
:wun/Form<form> wrapper. :id (form id used by :wun.forms/* intents).
:wun/FieldBound input. :form :name :type :label :placeholder.
:wun/FileInputFile picker that triggers a /upload POST. :form :field :accept :multiple.
:wun/ErrorBoundarySurfaced when a screen render throws. :reason (string).
:wun/WebFrameCapability fallback. :src :missing :reason.

A foundational binding

Here’s how :wun/Button is bound on each platform — the same keyword, three thin renderers around the platform’s native tap target. The platform choice you make below persists across the site.

(r/register! :wun/Button
(fn [{:keys [on-press tone]} children]
[:button {:class (str "wun-btn wun-btn-" (name (or tone :default)))
:on-click #(bus/dispatch! on-press)}
children]))

Adding more

Define one in wun-shared/src/wun/foundation/components.cljc, register a renderer in each platform, ship server HTML in wun.server.html, and bump its :since whenever the schema changes.

For app-specific components, use wun add component <ns>/<Name> which scaffolds the cljc declaration plus iOS Swift + Android Kotlin renderers and splices both registry files.