Download the PHP package el-schneider/statamic-choices without Composer
On this page you can find all versions of the php package el-schneider/statamic-choices. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download el-schneider/statamic-choices
More information about el-schneider/statamic-choices
Files in el-schneider/statamic-choices
Package statamic-choices
Short Description Card-style choice fieldtype for Statamic
License MIT
Informations about the package statamic-choices
Statamic Choices
Help editors make better decisions. Turn radios and checkboxes into visual choice cards.
A plain radio group asks editors to pick a word. Choices lets you show what they're actually picking — an image, a description, or trusted custom HTML when words won't cut it.
Features
- Single or multiple: Behaves like radios or checkboxes
- Rich cards: Label, image, description, or some fine custom HTML per option
- Two variants: Content cards for text-led choices, image cards when the picture is the choice
- Frontend-ready: Augments to full option objects with resolved assets
Requirements
- Statamic 5 or 6
- PHP 8.3+
Installation
Usage
Add a Choices field to your blueprint and configure the available options.
Single choice
Saved value:
Multiple choices
Saved value:
Configuration Reference
Field settings
| Setting | Values | Default | Description |
|---|---|---|---|
mode |
single, multiple |
single |
Whether the field behaves like radios or checkboxes. |
variant |
content, image |
content |
Content cards show labels/text. Image cards use full-bleed images. |
card_width |
100, 50, 33, 25, 20 |
100 |
Approximate card width before wrapping. |
image_aspect |
1/1, 4/3, 16/9 |
1/1 |
Image card aspect ratio. Only used by variant: image. |
default |
scalar or YAML array | — | Default selected value(s). |
Option settings
| Setting | Description |
|---|---|
value |
Stored value. Must be unique. |
label |
Human-readable label shown in the control panel and augmented output. Falls back to value. |
image |
Optional Statamic asset. Use normal asset IDs like assets::cards/basic.svg. |
description |
Optional supporting text for content cards. |
use_html |
Enables trusted custom HTML for content cards. When enabled, HTML replaces image and description. |
html |
Trusted HTML rendered inside the card. No Antlers rendering. |
Custom HTML
Content cards can swap their image and description for trusted custom HTML. Intended for blueprint configuration — not editor input. No Antlers.
Labels and selection controls stay under fieldtype control.
Image Cards
Image cards are useful for visual presets, colorways, layouts, or other choices where the image is the interface.
In image mode, labels are used for tooltips and accessible names. Descriptions and custom HTML are ignored.
Frontend Usage
The field stores only selected values. When augmented, it returns the selected option data.
Single mode
Augmented shape:
Multiple mode
Multiple selections are returned in the option order from the blueprint.
Notes
- Unknown saved values are ignored.
- Unprefixed image paths only resolve when exactly one asset container is configured. Prefer explicit IDs like
assets::path/to/image.svg.
Development
License
MIT