Sha256: 6ae7091a5cc9b511af3dcbf636b3e505804a94de2c84a0c62732eda168ab8378

Contents?: true

Size: 803 Bytes

Versions: 948

Compression:

Stored size: 803 Bytes

Contents

import React, { useEffect, useRef } from 'react'
import { Body, PhoneNumberInput } from 'playbook-ui'

const PhoneNumberInputAccessInputElement = (props) => {
    // 1. Create a ref - this accesses the kit's input element.
    const ref = useRef()

    // 2. Add any event listener to ref.current.inputNode() inside a useEffect hook and trigger it once.
    useEffect(() => {
        ref.current.inputNode().addEventListener("click", () => alert("Clicked!"))
    }, [])

    // 3. Pass the ref to the ref prop.
    return (
        <>
            <Body text="Click the input field below:" />
            <PhoneNumberInput
                id="access-input-element"
                ref={ref}
                {...props}
            />
        </>
    )
}

export default PhoneNumberInputAccessInputElement

Version data entries

948 entries across 948 versions & 2 rubygems

Version Path
playbook_ui_docs-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx