@props([ 'length' => 4, 'name' => 'otp', 'disabled' => 'false', // Alpine expression evaluated in the host scope 'error' => 'false', // Alpine expression evaluated in the host scope 'autofocus' => true, ]) {{-- Self-contained OTP input grid. Bubbles two events to the host scope: - `otp-input` detail = { code: '1234', complete: true|false } Fires on every keystroke / paste so the parent can mirror the assembled code into its local state. - `otp-complete` detail = { code: '1234' } Fires once when the user has typed exactly `length` digits — handy for auto-submitting on the last keystroke. Hosts can also reset the inputs by dispatching `otp-reset` on the window OR on the component element: this.$dispatch('otp-reset'); // window-level // or: document.querySelector('.otp-grid')?.dispatchEvent( new CustomEvent('otp-reset') ); Why all the indirection? The page direction may be RTL (Arabic) while a 4-digit numeric code is universally read left-to-right. Without `direction: ltr` on the grid container, CSS grid flips the cell order on RTL pages and the user ends up typing "1234" but storing "4321" because index 0 lands in the visually-rightmost cell. Hard-pinning LTR here means the host page's direction can be anything. --}}