concept-image / wp-core-ui
Core UI Blade components (section, container, heading…) for Concept Image Acorn themes: published into the theme by `core-ui:install`, unused ones removed by `core-ui:clean`.
Requires
- php: >=8.4
- roots/acorn: ^6.4
Requires (Dev)
- brain/monkey: ^2.6
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^4.0|^5.0
- pestphp/pest-plugin-arch: ^4.0|^5.0
- szepeviktor/phpstan-wordpress: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Core UI components for Acorn WordPress themes
The core Blade components of Concept Image themes: layout (section, container, heading), media (image, figure, oEmbed video), button, WYSIWYG content and the layout's head and accessibility helpers (favicon, skip link, breadcrumb), built with the theme's Tailwind tokens. They are published into the theme and belong to the project from then on:
wp acorn core-ui:installcopies the components missing from the theme;wp acorn core-ui:cleandeletes the ones the theme doesn't use.
Principles. A core component is a Blade class and view using only Tailwind utility classes (the theme's tokens)
and Alpine.js directives: no CSS file, <style>, @apply, <script>, TypeScript module, npm library or jQuery.
A component needing more belongs in the theme or a dedicated package.
Requirements
- PHP 8.3+
- WordPress on Bedrock, Roots Acorn 6.1+
- The tokens and utilities of
concept-image/wp-starter-theme's theme styles (Tailwind 4)
concept-image/wp-starter-theme requires it: Concept Image themes get it automatically.
Installation
composer require concept-image/wp-core-ui # in the theme directory (normally via wp-starter-theme)
wp acorn core-ui:install # publish the components into the theme
The classes go to app/View/Components/Core/ (App\View\Components\Core), the views to
resources/views/components/core/. Laravel discovers them as <x-core.*>.
Components
| Tag | Renders | Props | Depends on |
|---|---|---|---|
<x-core.section> | Block wrapper: <section> with anchor, vertical padding and background | anchor, background (default, primary, secondary) | |
<x-core.container> | Centered max-width wrapper (container + container-max-w-{size}) | size (default, form, large, screen) | |
<x-core.heading> | <h1>–<h4> with the fluid title sizes | level (1–4, default 2), size (xl, lg, base, sm; default: the level's) | |
<x-core.image> | Attachment <img> (wp_get_attachment_image()), lazy by default | image (ACF array or ID), size (default medium_large), width, height, cover, eager, alt (false: decorative), customsrcset, class | |
<x-core.figure> | <figure> with the image and its caption; the image alone without caption, nothing without image | image, size, image-class, caption (default: the ACF image's) | <x-core.image> |
<x-core.oembed> | YouTube / Vimeo from an ACF oEmbed field: poster and play button, the no-cookie player loaded on click; or a muted background video | url (ACF value: HTML or URL), poster, poster-size, ratio (video, wide, classic, square, portrait), background, title, eager | <x-core.image> |
<x-core.button> | Link, <button type="button"> or <span> styled as a button | label, href, type (link, button, span), mainColor (primary, secondary, white) | |
<x-core.wysiwyg> | WYSIWYG HTML through wp_kses_post() in a .wysiwyg wrapper, nothing when empty | content | |
<x-core.breadcrumb> | Yoast SEO breadcrumb <nav class="breadcrumb">, when config('theme.supports.breadcrumbs') | class | |
<x-core.favicon> | Favicon <link> tags of the theme's public/favicon/ files | ||
<x-core.skip-links> | Skip link to the main content, visible on focus | id (default content), label |
<x-core.section :anchor="$anchor" :background="$background_color">
<x-core.container class="space-y-6 md:space-y-8">
<x-core.heading :level="2">{{ $title }}</x-core.heading>
<x-core.wysiwyg :content="$text" />
<x-core.figure :image="$image" size="large" />
<x-core.button :href="$link['url']" :label="$link['title']" />
</x-core.container>
</x-core.section>
<x-core.section> only sets the padding and background: its content chooses its width (<x-core.container>, or
none for a full-width block). Unknown prop values fall back to the default. Other attributes (class, data-*,
Alpine directives…) are merged onto the root element.
Image has no view (it renders wp_get_attachment_image()), skip-links and wysiwyg are anonymous components (a
view, no class): core-ui:install copies the files each one has.
Videos (<x-core.oembed>)
<x-core.oembed :url="$video" :poster="$poster" class="rounded-3xl" /> {{-- click to play --}}
<x-core.section class="relative isolate min-h-[70vh]">
<x-core.oembed :url="$video" background class="-z-10" /> {{-- background video --}}
…
</x-core.section>
Nothing is loaded from YouTube or Vimeo before the click (no iframe, no cookie, no player script): only the poster
(the poster image, else YouTube's static thumbnail or Vimeo's, fetched server-side and cached a week) and an
Alpine play button, which preconnects to the player on hover. The player uses youtube-nocookie.com (related videos
limited to the channel, no annotations, inline on iOS) or Vimeo with dnt=1 (no title, byline, portrait). background
renders a muted autoplaying loop without controls covering its positioned parent (Vimeo's background=1, best
result; YouTube with controls off), lazy-loaded, skipped with prefers-reduced-motion. Other providers render
WordPress' oEmbed HTML in the ratio box.
wp-fortress' CSP and Permissions-Policy must allow the players: frame-src https://www.youtube-nocookie.com
https://player.vimeo.com, img-src https://i.ytimg.com https://i.vimeocdn.com, and
fullscreen=(self "https://www.youtube-nocookie.com" "https://player.vimeo.com").
Theme tokens
The classes come from the theme styles of wp-starter-theme: theme.css (--color-primary, --color-secondary,
--font-title, --text-fluid-h1 … --text-fluid-h4, --container-max-width*, --container-padding,
--container-min-width), utilities.css (@utility container, @utility container-max-w-*) and variant.css
(hocus:, group-hocus: for the button). The theme also provides what some components expect around them:
components/wysiwyg.css (.wysiwyg) and components/breadcrumb.css (.breadcrumb), the @filled Blade
directive (wysiwyg), theme.supports.breadcrumbs and Yoast SEO (breadcrumb), the public/favicon/ files
(favicon), and <main id="content" tabindex="-1"> in the layout (skip link).
Commands
wp acorn core-ui:install # every missing component
wp acorn core-ui:install figure heading # some components, plus their dependencies (figure → image)
wp acorn core-ui:install --force # overwrite the theme's copies
wp acorn core-ui:clean --dry-run # list the unused components' files
wp acorn core-ui:clean # delete them, after confirmation (--force: without asking)
core-ui:install keeps the files that already exist (status kept) and prints a summary table. An unknown name
fails and lists the valid ones.
core-ui:clean scans the theme's app/, resources/views/ and stubs/ (wp-make-block stub overrides) for the
tags (<x-core.section, </x-core.section), class references (Components\Core\Section) and view names
(components.core.section), outside the components' own files. The components used components reference are
kept too; a component only an unused one references is deleted. Only the class and view of registered components
are deleted, and the Core directories when left empty. Without --force, a non-interactive run deletes nothing.
wp acorn make:block(wp-make-block),wp acorn make:cpt(wp-make-cpt) and wp-blocks' published base blocks generate<x-core.*>tags (section, container, heading, image, wysiwyg…): after a clean, runwp acorn core-ui:installagain before generating or publishing.
Customizing
The published files are project code: edit them in the theme. Add a background, a size or a color as a new key
of the $backgrounds / $sizes / $colors arrays, with the Tailwind classes written in full (Tailwind only generates the classes it
finds whole), and the token in theme.css when it's new. Package updates never change the theme's copies: the
CHANGELOG says what to change when a component is fixed, or use core-ui:install <name> --force
for a copy that was never edited.
Claude Code
Bedrock projects have no Laravel Boost, so the package publishes its AI guidance straight into the Bedrock root, where Claude Code loads it on its own:
.claude/skills/wp-core-ui/: thewp-core-uiskill (components and props, tokens, customizing, commands);.claude/rules/wp-core-ui/: rules loaded by path (wp-core-ui.mdalways;components.mdfor the theme's core component files).
wp acorn starter:ai (wp-starter-theme) publishes them with the other Concept Image packages' files. Directly:
wp acorn vendor:publish --tag=wp-core-ui-ai --force # skill and rules
wp acorn vendor:publish --tag=wp-core-ui-skill --force # skill only (wp-core-ui-rules: rules only)
Development
composer ci # Pint, Larastan (level max on src/), PHPStan level 5 on components/app, Pest (Testbench)
Without PHP's dom/xml/mbstring extensions on the host:
docker run --rm -u "$(id -u):$(id -g)" -v "$PWD":/app -w /app composer:2 composer ci.
components/mirrors a theme and is excluded from Pint: the files ship as theme code.src/CoreComponent.phpregisters every component (name, files, dependencies): the commands, tests and docs read it.- Tests run in a temporary theme (Testbench base path), so the commands write real files.
Changelog
Please refer to CHANGELOG for more information.
License
Please refer to LICENSE for more information.
Credits
- Extracted from
concept-image/wp-starter-theme(section, container and heading in 0.1, image, figure, button, wysiwyg, breadcrumb, favicon and skip-links in 0.2). - Banner icon: Pop it icons created by Magnific - Flaticon