From dbd7b21db0175964032a8f288bc674cee6ad22e4 Mon Sep 17 00:00:00 2001 From: Shane Rosenthal Date: Mon, 10 Aug 2026 17:20:50 -0400 Subject: [PATCH] Mobile v4 docs: UI component plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plugins can declare new EDGE element types — a `components` block in nativephp.json wiring a PHP Element and Blade component to a Compose renderer and a SwiftUI renderer — and `native:plugin:create` scaffolds the whole thing. None of it was documented; the plugins section only covered bridge functions and native capabilities. Adds plugins/ui-components, covering the manifest fields and their validation, the type → tag mapping (including why dotted types are only reachable via the x-native- component form), the Element and Blade component contracts, both renderers with their props/children/event APIs, how registration is generated at boot and at build, and testing. Ends with the lighter alternative — shipping a composed NativeComponent via ComponentRegistry, no native code. Cross-links it from the plugins introduction, creating-plugins, the EDGE components introduction, and nested-components. Co-Authored-By: Claude Opus 5 (1M context) --- .../mobile/4/edge-components/introduction.md | 8 + .../docs/mobile/4/plugins/creating-plugins.md | 4 + .../docs/mobile/4/plugins/introduction.md | 5 +- .../docs/mobile/4/plugins/ui-components.md | 393 ++++++++++++++++++ .../mobile/4/the-basics/nested-components.md | 4 + 5 files changed, 413 insertions(+), 1 deletion(-) create mode 100644 resources/views/docs/mobile/4/plugins/ui-components.md diff --git a/resources/views/docs/mobile/4/edge-components/introduction.md b/resources/views/docs/mobile/4/edge-components/introduction.md index 46deb0aff..19bace075 100644 --- a/resources/views/docs/mobile/4/edge-components/introduction.md +++ b/resources/views/docs/mobile/4/edge-components/introduction.md @@ -56,6 +56,14 @@ these docs for two reasons: Drop the prefix for terser templates whenever you prefer — both forms are fully supported. +## Building your own + +The components in this section are shipped by a plugin — `nativephp/mobile-ui` — using the same public mechanism your +own packages can use. If you need an element EDGE doesn't have, a +[UI component plugin](../plugins/ui-components) adds a new element type backed by your own SwiftUI view and Compose +composable. If you only need a reusable arrangement of existing elements, reach for a +[nested component](../the-basics/nested-components) instead — no native code required. + ## Why Blade? Blade is an expressive and straightforward templating language that is very familiar to most Laravel users, and also diff --git a/resources/views/docs/mobile/4/plugins/creating-plugins.md b/resources/views/docs/mobile/4/plugins/creating-plugins.md index 0bcc65f53..ba4fc4132 100644 --- a/resources/views/docs/mobile/4/plugins/creating-plugins.md +++ b/resources/views/docs/mobile/4/plugins/creating-plugins.md @@ -13,6 +13,10 @@ php artisan native:plugin:create This walks you through naming, namespace selection, and feature options, then generates a complete plugin structure. +The first prompt asks which kind of plugin you're building. A **system plugin** adds native capabilities you call from +PHP — the rest of this page. A **UI component plugin** adds new EDGE elements rendered by your own SwiftUI and Compose +code; see [UI Component Plugins](./ui-components) for that path. + +A Composer package can register components the same way from its own service provider's `boot()` — that's the +lightest way to distribute reusable UI. When you need a genuinely new element rather than an arrangement of existing +ones, see [UI Component Plugins](../plugins/ui-components). + ## Props Tag attributes assign to the child's matching public properties: