Skip to content

Forward icon:variant to input action sub-components#2566

Merged
calebporzio merged 1 commit intomainfrom
josh/forward-icon-variant-to-input-actions
Apr 19, 2026
Merged

Forward icon:variant to input action sub-components#2566
calebporzio merged 1 commit intomainfrom
josh/forward-icon-variant-to-input-actions

Conversation

@joshhanley
Copy link
Copy Markdown
Member

@joshhanley joshhanley commented Apr 16, 2026

The Scenario

When using viewable, clearable, copyable, or expandable on a <flux:input>, the action icons use hard-coded variants with no way to customise them. The icon:variant prop on the input only affects leading/trailing icons, not the action sub-components.

{{-- icon:variant="outline" only affects leading/trailing icons, not the viewable eye icon --}}
<flux:input type="password" viewable icon:variant="outline" icon="lock-closed" />

The Problem

Each action sub-component hard-coded its own icon variant rather than inheriting from the parent input's $iconVariant prop:

  • viewable.blade.php: variant="micro"
  • clearable.blade.php: variant="micro"
  • expandable.blade.php: variant="micro"
  • copyable.blade.php: variant="mini"

The parent input/index.blade.php already accepted icon:variant (defaulting to mini) but never forwarded it to these sub-components.

The Solution

Forward $iconVariant from the parent input component to all four action sub-components (viewable, clearable, copyable, expandable), replacing the hard-coded variants. This allows users to customise the icon variant via icon:variant:

<flux:input type="password" viewable icon:variant="outline" />
<flux:input clearable icon:variant="micro" />

All sub-components now default to mini (the input's default), which also fixes the inconsistency where copyable used mini but the other three used micro.

Screenshot 2026-04-16 at 12 18 08PM@2x

Fixes #2335

The `viewable`, `clearable`, `copyable`, and `expandable` sub-components
previously hard-coded their icon variants (`micro` or `mini`). This
forwards the parent input's `$iconVariant` prop (default `mini`) to all
four sub-components, allowing users to customise the icon variant via
`icon:variant` on the input.
@ghabriel25
Copy link
Copy Markdown
Contributor

ghabriel25 commented Apr 17, 2026

Hi, @joshhanley

Navbar item trailing icon also hardcoded its variant. Shouldn't it forwarded too or its intended?

<flux:navbar class="max-lg:hidden">
    <flux:navbar.item :href="route('home', absolute: false)"
                      icon:trailing="home"
                      icon:variant="outline"
                      wire:navigate>Home</flux:navbar.item>
</flux:navbar>
image

@calebporzio calebporzio merged commit 061306e into main Apr 19, 2026
@calebporzio
Copy link
Copy Markdown
Contributor

thanks Josh!

@calebporzio calebporzio deleted the josh/forward-icon-variant-to-input-actions branch April 19, 2026 13:57
@hebbet hebbet mentioned this pull request Apr 23, 2026
3 tasks
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.

3 participants