Skip to content

Add input: attribute prefix for targeting the input element#2438

Open
joshhanley wants to merge 1 commit intomainfrom
josh/input-attribute-prefix
Open

Add input: attribute prefix for targeting the input element#2438
joshhanley wants to merge 1 commit intomainfrom
josh/input-attribute-prefix

Conversation

@joshhanley
Copy link
Member

@joshhanley joshhanley commented Feb 25, 2026

The Scenario

When using flux:input, classes and attributes need to be targeted to the inner <input> element rather than the wrapper <div>. Previously, this was only possible using the class:input syntax, which is inconsistent with the nested:attribute convention used by other Flux components (e.g., field:class, label:class, container:class).

<flux:input class="max-w-xs" input:class="text-green-500!" placeholder="Name" />

<flux:input label="Email" input:class="text-green-500!" />

The Problem

The input component only supported the legacy class:input syntax for targeting classes to the <input> element. Other components use the nested:attribute prefix convention (e.g., field:class, label:class, container:class), but the input component didn't support input:class or other input:* attributes.

The Solution

Added support for the input: attribute prefix using the same Flux::attributesAfter() pattern used throughout the codebase. Any input:* attributes are extracted and merged onto the <input> element. The existing class:input syntax continues to work for backwards compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant