Search by

celo4ever / craft-fields-library

celo4ever

Build Craft CMS pages from ready-made blocks, and style every block visually.

Package info

github.com/celo4ever/craft-fields-library

Type:craft-plugin

pkg:composer/celo4ever/craft-fields-library

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-12-01 11:17 UTC

This package is auto-updated.

Last update: 2026-12-01 19:32:55 UTC


README

Build Craft CMS pages from ready-made blocks, and style every block visually.

The preset editor: the Hero's elements on the left, the live preview in the middle, the style panel on the right

Fields Library gives your Craft site a library of page blocks, such as heroes, features, FAQs, tabs, testimonials, forms, a nav and a footer. Each block comes with presets, saved looks you design in a visual editor, at every screen size, without writing CSS.

  • Developers install the library, design the presets and set the Brand, the colours, fonts and spacing of the whole site.
  • Content editors build pages from blocks, write the content and pick a preset for each block.
  • Designers draw new blocks in Figma, and the importer turns them into blocks of your site, with their presets.

Features

24 components, 90 presets. Hero, Hero carousel, CTA, Columns, Content, Entries, Features, Carousel, FAQs, Brands, Testimonials, Form, Tabs, Pricing, Timeline, Countdown and a Table of contents, inside Sections you stack on a page or open as popups, plus the Nav and the Footer. Buttons, links, testimonial cards and long texts share their look through style presets.

A visual preset editor. Select any element of a block and set its layout, spacing, colours, type, borders and effects for each screen size. Show or hide it per size, make it react on hover, by itself, with its card or with the whole block, and see every change live.

The Hero's presets, Split, Centered and Full Screen, each with a thumbnail

A Brand for the whole site. Colour scales, fonts with matched fallbacks so nothing shifts while they load, a type scale, spacing, corner radius and the motions an element can play. Every preset uses them, and a contrast check tells you when a colour would make text hard to read. Save a Brand to a file and load it on another site, then export your presets and import them there, with the button styles they use.

The Brand page: the primary accent and the neutral scale with their ten shades, and the live preview of a preset

Import from Figma, with Claude Code. Give Claude Code a component's link in a prepared Figma file:

Import this Figma component as "Acme · Hero": <figma link>

It builds a new block with its fields, templates and presets, measures it against the design, and adds it to a review board in the Control Panel, where you review it and approve it. Problems go back to Figma as comments, and the same skills help prepare a file and fix an import.

The imports of a Figma file: each component with its station on the review board, from In design to Ok

Page templates. Put presets together into a page and see the whole page, with its real spacing and backgrounds, before anyone writes a word. Link pages to a template, and their editors write only the content, while a change to the template reaches every page that follows it.

Extend it in code. Make components of your own with presets, or change a library component's templates while still getting its updates.

Ready for production.

  • Presets and the Brand deploy with Project Config, like your fields and sections.
  • Production stays read-only.
  • Every shipped preset meets WCAG 2.2 AA with the default Brand, as axe measures it.
  • It works alongside SEOmatic and Formie.

Requirements

  • Craft CMS 5.11 or later
  • PHP 8.4 or later
  • Node.js 20.19 or 22.12 or later, for the front-end build with Vite, Tailwind CSS 4 and the Vite plugin for Craft
  • Optional: CKEditor 5 for formatted text and the Brand's text marks, Formie 4 for forms, SEOmatic 5 for SEO

Fields Library 1.0 is in English. The messages Craft translates (the fields-library category) ship with an English catalogue that a site can translate. The preset editor, the Brand page and the presets pages are in English only.

Installation

Note

The commands below are written for php craft. In a DDEV project, run them as ddev craft, ddev composer and ddev npm.

1. Install the plugins

Fields Library isn't in the Plugin Store yet, so you add its GitHub repository to your project and require it from there. Require the Vite plugin for Craft with it, because it loads your site's build into its pages:

composer config repositories.fields-library vcs https://github.com/celo4ever/craft-fields-library
composer require celo4ever/craft-fields-library:dev-main nystudio107/craft-vite

The first time, Composer asks for a GitHub token from an account that can read the repository.

If you want to work on the plugin itself, clone it into plugins/fields-library and add it as a path repository instead:

composer config repositories.fields-library path plugins/fields-library

The plugin creates an assets volume for images, so tell it in .env where uploads go:

LOCAL_ASSETS_URL="@web/uploads"
LOCAL_ASSETS_PATH="@webroot/uploads"

Then install the plugins:

php craft plugin/install vite
php craft plugin/install fields-library

If you want formatted text, install CKEditor for Craft first, with composer require craftcms/ckeditor and then php craft plugin/install ckeditor. The rich text and the titles then take bold, italic, links and the Brand's text marks. Without it, they're plain text, and their paragraphs and line breaks show on the site. If you add CKEditor later, the fields-library/install/ckeditor command writes the migration that gives those fields CKEditor and keeps what editors wrote. Run php craft up after it, here and on every other environment.

Installing Fields Library sets up everything a page builder needs:

  • an assets volume;
  • the page builder's 74 fields and 32 entry types;
  • the Header, Footer, Company and Popups globals, for the nav, the footer, your logo and the popups every page holds;
  • a Home page, a Pages section for the site's other pages (About, Services, Contact, nested as you like) and a Posts channel;
  • the 90 presets.

It never changes anything your site already has, so it's safe on an existing site. If something goes missing later, the fields-library/install command runs the same setup again and adds only what's missing. The fields-library/install/plan command shows what it would do, without writing anything.

2. Write the front end

The blocks are styled with Tailwind CSS classes, so your site needs a front-end build, in which Vite and Tailwind CSS 4 compile its CSS and JavaScript. The install/frontend command writes the files that connect your site to the plugin, and npm install installs their packages:

php craft fields-library/install/frontend
npm install

The command writes these files:

File What it is
package.json The packages and the build script
vite.config.js, config/vite.php The build, and where Craft finds it
src/css/app.css, src/js/app.js The CSS and JavaScript entries, with Tailwind, the Brand, and the blocks' menus, tabs and carousels
templates/_layout.twig The page shell, with the fonts, the favicon, the build, the nav, the footer and the site-wide popups
templates/_page.twig, templates/_post.twig The Home page and every page of the Pages section, made of blocks, and a post of the Posts channel, with its body in the Brand's styles for long text

The command never changes a file your site already has. It checks that file instead, and tells you what the plugin needs from it, such as a line to add or an npm command to run. Add the --dry-run option to see that list without writing anything. The files themselves are in resources/starter/, if you'd like to read them first.

These files build for production. If you'd rather work with Vite's dev server, the Vite plugin's documentation explains how.

3. Build

The build compiles your site's CSS and JavaScript. Before Vite runs, it asks Craft for your Brand and your presets, so run it where php craft works (in DDEV, ddev npm run build). Then run the css/verify command:

npm run build
php craft fields-library/css/verify

The build writes the Brand's CSS variables and the list of classes your presets use into src/css/. Commit those files with your site. The css/verify command checks that every one of those classes made it into the built CSS, so no block shows up unstyled. Your site is ready for its first page.

Your first page

  1. In the Control Panel, go to Entries and open Home.
  2. Under Sections, click New section. A section is a band of the page, and it opens in a panel beside the page. Its Preset sets the space above it, and it reads Default · Space above until you pick another.
  3. Open the section's Modules tab, click New entry and choose Hero. Write its title.
  4. Choose the Hero's look in its Preset field (Split, Centered or Full Screen). Click Create entry, which closes the section's panel, then Save.

Choosing the Hero's preset in the Home entry: Default · Split, then Split, Centered and Full Screen, each with its thumbnail

Open your site to see the page. The logo, the menu and the footer every page shows are filled in under Globals, in Library · Company, Library · Header and Library · Footer.

To change how a preset looks, go to Fields Library › Presets, open the component and then the preset. Every block that uses it updates.

Deploying

Presets and the Brand are stored in Project Config, under config/project/fieldsLibrary/, next to your fields and sections. Commit them, and deploy as you already do:

php craft up
npm run build

Where the allowAdminChanges setting is off, as it should be in production, the preset editor and the Brand page are read-only. Design in development, commit, deploy.

Updates

Fields Library follows Semantic Versioning. A patch only fixes, a minor version adds without breaking anything, and only a major version changes what your site builds on, with an upgrade guide. An update carries your presets, Brand and page templates forward when you run php craft up. Backward compatibility lists what the promise covers.

Commands

Command What it does
fields-library/install, install/plan, install/frontend Set a site up, show what that would do, write its front end
fields-library/presets/list, install, import, export, validate, delete Work with presets from the console
fields-library/templates/list, export, validate, import, delete Work with page templates from the console
fields-library/brand/export, save, load Write the Brand's CSS, save the Brand to a file, load one
fields-library/css/export, verify Write the class list for Tailwind, check the built CSS
fields-library/components/create, validate, migration, remove Make and manage a component of your own
fields-library/components/wrap, eject, fork, check Change a component's templates in code, and see what changed upstream
fields-library/figma/doctor, import, review, status Check a project can import from Figma, import a component, review imports
vendor/bin/figma-verify <handle> Measure an import against its Figma design
fields-library/skills/install Add the plugin's Claude Code skills to your project

Run any of them with --help for its options. Commands describes each one, with an example.

Code conventions

The code follows Craft's coding guidelines, with three conventions of its own:

  • Contracts in place of PHPDoc. A // Pre: and // Post: contract sits above every PHP method, and TSDoc @pre and @post on every exported TypeScript function, saying what the code expects and what it guarantees.
  • No _ prefix. Private members don't take one.
  • No empty(). An empty array is tested with === [].
  • Public or internal. Every class under src/ is public, on the list in tests/Compatibility/Support/public-surface.php, or marked @internal; tests/golden/public-api.json pins the public surface.

Each release follows the makers' release checklist, and the public surface's diff since the last tag decides its version.

License

Fields Library is commercial software, under the terms of LICENSE.md. For help, open an issue in this repository. It is free to try in development; on a production domain without a valid licence its design tools (the preset editor, the Brand, page templates and imports) are read-only, while the site and its content keep working.

It carries a few open-source packages, such as Vue, Pinia and axe-core. THIRD-PARTY-NOTICES.md lists them with their licences, and what the plugin loads from the internet.