Miniset allows you to create compact sets of fields that either combine into a string of classes, or return a simple array of values

Overview

Statamic Packagist version License

Miniset

Miniset allows you to create compact sets of fields that either combine into a string of classes, or return a simple array of values.

Miniset includes the following components:

  • Miniset
    A general purpose fieldtype for creating a compact set of fields that return a simple array of values.
  • Miniset Classes
    A class specific fieldtype for creating a compact set of fields that combine into a string of classes, including variant options. Works great with Tailwind CSS.

Installation

You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:

composer require jacksleight/statamic-miniset

Creating a Miniset Field

Create a Miniset field and add your nested fields. Miniset is intended for simple data (single or multiple scalar values) and only officially supports these nested fieldtypes:

  • Select (inc. multiple)
  • Button Group
  • Checkboxes
  • Radio
  • Text
  • Textarea
  • Toggle
  • Range

Other fieldtypes can be added but will not have a compact style.

Miniset returns a simple array of values which can either be output in its entirety, or individual values can be output by referencing their key:

{{ my_options | json }}
{{ my_options.theme }}

Creating a Miniset Classes Field

Create a Miniset Classes field and add your nested fields and variants. Miniset Classes only supports the following nested fieldtypes:

  • Select (inc. multiple)
  • Button Group
  • Checkboxes
  • Radio
  • Text (not jit_safe compatible)
  • Textarea (not jit_safe compatible)

Other fieldtypes should not be added and may cause errors or unexpected results.

Variants will be offered as options when adding groups of fields. By default the variant keys will be prepended to the class value and seperated with a colon:

lg / w-32 --> lg:w-32

If you're not using this convention you can customize the behaviour by including an ampersand in your variant keys. The ampersand will be replaced with the class value when augmented:

&@large / width-half --> width-half@large

Miniset Classes will return a single string of classes that can be output in a class attribute:

">
<div class="{{ my_classes }}">

Using jit_safe mode with Tailwind

When using Tailwind the JIT compiler scans your content for classes, and this will need to include any classes that could be selected by users in the control panel. To simplify this process Miniset has a jit_safe mode. To enable this publish the config:

php please vendor:publish --tag=statamic-miniset-config

Then open config/statamic/miniset.php and set the jit_safe.enable option to true:

'jit_safe' => [
    'enable' => true,
    'file'   => resource_path('css/statamic/miniset_classes.yaml'),
],

Once enabled Miniset will scan your fields and save a full list of possible classes to resources/css/statamic/miniset_classes.yaml whenever you update a blueprint or fieldset.

You can then tell Tailwind to search this file in your tailwind.config.js:

content: [
    './resources/css/statamic/miniset_classes.yaml',
],

You can also manually run this scan on all fieldsets and blueprints via the command line using php please miniset:jit-safe-scan.

You might also like...
Coder Metabox for WordPress - Create Pages, Posts Custom Meta Fields options

Coder Metabox for WordPress Coder Metabox for WordPress - Create Pages, Posts Custom Meta Fields options. Step 1 call coder-metabox.php file in functi

Provides a configuration factory and multiple rule sets for friendsofphp/php-cs-fixer.

php-cs-fixer-config Provides a configuration factory and multiple rule sets for friendsofphp/php-cs-fixer. Installation Run $ composer require --dev e

Library allows to detect emoji, remove emoji, encode emoji and decode emoji in string.

It allows to detect emoji, remove emoji, encode emoji and decode emoji in string. Installation composer require anisimov/emoji How to use Encode and

This is a class that allows you to import posts from Wix into WordPress.

Wix Posts to WordPress This is a class that allows you to import posts from Wix into WordPress. Requirements Please make sure you have the following i

Scotch Box is a preconfigured Vagrant Box with a full array of LAMP Stack features to get you up and running with Vagrant in no time.
Scotch Box is a preconfigured Vagrant Box with a full array of LAMP Stack features to get you up and running with Vagrant in no time.

Scotch Box is a preconfigured Vagrant Box with a full array of LAMP Stack features to get you up and running with Vagrant in no time.

A useful PocketMine-MP plugin that allows you to create crates in-game!

ComplexCrates A useful PocketMine-MP plugin that allows you to create crates in-game! Commands Main command: /crate Sub commands: create

This plugin allows you to create many-to-many relationships between pages in Kirby and synchronizes them on both sides.
This plugin allows you to create many-to-many relationships between pages in Kirby and synchronizes them on both sides.

Kirby 3 Many To Many Field This plugin allows you to create many-to-many relationships between pages in Kirby.

Venture allows you to create and manage complex, async workflows in your Laravel apps.

Venture is a package to help you build and manage complex workflows of interdependent jobs using Laravel's queueing system. Installation Note: Venture

A set of classes to create and manipulate HTML objects abstractions

HTMLObject HTMLObject is a set of classes to create and manipulate HTML objects abstractions. Static calls to the classes echo Element::p('text')-cla

Releases(0.3.1)
Owner
Jack Sleight
Freelance full-stack developer. Love building sharp interfaces and working with Laravel, Statamic and Filament.
Jack Sleight
It allows frontend developer to send ajax requests and return a custom information from the server without a php developer help

[Magento 1 Extension] It allows frontend developer to send ajax requests and return a custom information from the server without a php developer help (without any php code).

Vladimir Fishchenko 62 Apr 1, 2022
Glz custom fields - Unlimited Custom Fields for Textpattern

Unlimited custom fields for Textpattern This plugin sits under the Extensions tab in the back-end and gives your custom fields new life. You can final

Gerhard Lazu 21 Dec 1, 2019
PHP Japanese string helper functions for converting Japanese strings from full-width to half-width and reverse. Laravel Rule for validation Japanese string only full-width or only half-width.

Japanese String Helpers PHP Japanese string helper functions for converting Japanese strings from full-width to half-width and reverse. Laravel Rule f

Deha 54 Mar 22, 2022
Greyhole uses Samba to create a storage pool of all your available hard drives, and allows you to create redundant copies of the files you store.

Greyhole Greyhole is an application that uses Samba to create a storage pool of all your available hard drives (whatever their size, however they're c

Guillaume Boudreau 245 Dec 18, 2022
Add scalar type hints and return types to existing PHP projects using PHPDoc annotations

PHPDoc to Type Hint Archived! This repository is now archived. Consider using PHP CS Fixer (and especially the phpdoc_to_param_type and phpdoc_to_retu

Kévin Dunglas 228 May 22, 2022
All about docker projects either from dockerfile or compose. Anyway, here the project is in the form of a service, for the programming language I will make it later

Docker Project by ItsArul Hey, yo guys okay, this time I made some projects from Docker. Anyway, this project is open source, for example, if you want

Kiyo 10 Nov 4, 2022
Description: A simple plugin that sets the current admin page to always be at the top of the admin menu.

=== Sticky Admin Menu === Contributors: sc0ttkclark Donate link: https://www.scottkclark.com/ Tags: admin menu, sticky Requires at least: 4.4 Tested u

Scott Kingsley Clark 2 Sep 29, 2022
Talkino allows you to integrate multi social messengers and contact into your website and enable your users to contact you using multi social messengers' accounts.

Talkino Welcome to our GitHub Repository Talkino is a click to chat plugin to show your agents’ multiple social messengers, phone and emails on the ch

Traxconn 2 Sep 21, 2022