Skip to content

Setting Types ​

Every editable control in FilamentCraft — whether it lives in a section's settings panel or a theme's template-settings panel — is declared with a small PHP DSL. Each control is a Setting subclass under FilamentCraft\Settings\Types, instantiated with a make('id') call and configured fluently:

php
use FilamentCraft\Settings\Types\Text;

Text::make('heading')
    ->label('Heading')
    ->default('Welcome')
    ->required();

The editor compiles each Setting into a real Filament v4 form component at runtime, so the inputs you get are the same battle-tested fields Filament renders everywhere else — wired up for FilamentCraft's live-preview bus.

A compiled settings panel in the editor
A section's settings panel — every control here started life as a one-line Setting declaration, grouped with Group dividers.

The 18 built-in types ​

TypeClassPage
TextTextText inputs
TextareaTextareaText inputs
NumberNumberText inputs
RangeRangeText inputs
SelectSelectChoice inputs
RadioRadioChoice inputs
CheckboxCheckboxChoice inputs
Enum buttonsEnumButtonsChoice inputs
ColorColorColor inputs
Color schemeColorSchemeColor inputs
Color scheme groupColorSchemeGroupColor inputs
FontFontFont picker
ImageImageMedia & content
IconIconMedia & content
LinkLinkMedia & content
Rich textRichTextMedia & content
GroupGroupLayout & structure
CategoryCategoryLayout & structure

Shared API (every type) ​

All setting types inherit the same base methods from FilamentCraft\Settings\Setting:

MethodPurpose
make(string $id)Construct the setting. The id must match /^[a-z0-9_][a-z0-9_-]*$/i.
label(string $label)The field label shown in the editor.
default(mixed $value)The value used until the user changes it.
info(string $text)Helper text rendered under the field.
required(bool $value = true)Mark the field required.
visibleIf(array $predicates)Show the field only when other fields match — e.g. ->visibleIf(['cta_enabled' => true]).
cssVar(string $name, ?string $unit = null)Bind the value to a CSS custom property in <style id="fc-tokens">. The optional unit is appended to numeric values.

cssVar() is what makes a setting themeable: the resolved value is written to :root as a CSS variable so your section Blade and theme CSS can read it. See Theme Authoring for the full token pipeline.

php
Range::make('button_radius')
    ->cssVar('--button-radius', 'px')
    ->min(0)->max(24)->default(8);
// emits:  --button-radius: 8px;

Live-update behaviour ​

When a setting changes in the editor, FilamentCraft pushes the change to the preview iframe. The SchemaCompiler chooses one of two Livewire live modes per type — you never configure this, it is automatic:

  • Instant live() — fires on every change. Used for discrete, one-click inputs: Checkbox, Radio, EnumButtons, Select, ColorScheme, Font, Icon.
  • Lazy live(onBlur: true) — defers the round-trip until the field loses focus. Used for typed/dragged/uploaded inputs where a half-finished value shouldn't trigger a re-render: Text, Textarea, Number, Range, Color, Image, Link, RichText.

The lazy mode matters most for RichText: Filament v4's TipTap editor throws if the surrounding DOM is morphed mid-keystroke, so the round-trip is deferred to blur.

Where settings are used ​

  • In a section — return them from the static settings() method. See Custom Sections. Section settings can also mix in raw Filament v4 components (e.g. Toggle, ColorPicker) alongside the DSL.
  • In a theme — return them from settingsSchema(), usually wrapped in Category groups. See Theme Authoring.

Proprietary — distributed via Anystack.