Add toggle prop to OTP for private mode visibility#2449
Closed
aydinza wants to merge 1 commit intolivewire:mainfrom
Closed
Add toggle prop to OTP for private mode visibility#2449aydinza wants to merge 1 commit intolivewire:mainfrom
aydinza wants to merge 1 commit intolivewire:mainfrom
Conversation
Adds a `toggle` prop to `flux:otp` that renders an eye/eye-slash button to toggle input visibility when used with `private`. This allows users to reveal masked OTP values without requiring custom Alpine code. Usage: ```blade <flux:otp wire:model="pin" length="6" private toggle /> ``` The toggle button uses Alpine to reactively switch input types between `password` and `text`. It only renders when both `private` and `toggle` are set.
Collaborator
|
Hi @aydinza Thanks for contributing. We're going to hold off on this for now. I see the need for this however I'm unsure about the API, design and implementation. If you believe this should be part of Flux please open a discussion with a feature request and we will consider this once there's enough demand from community. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
toggleprop toflux:otpthat renders an eye/eye-slash button to toggle input visibility when used alongsideprivatex-effectto reactively switch input types betweenpasswordandtextprivateandtoggleare setUsage
Also works with custom slot markup:
Motivation
PIN and OTP inputs often need a visibility toggle for accessibility and usability. Currently, achieving this requires custom Alpine code outside the component. This prop provides a native, zero-config solution.