Sha256: 18fd9ce8df9e681035b7b13e85d38ebd5369473e530282e525192669a6817c67

Contents?: true

Size: 797 Bytes

Versions: 625

Compression:

Stored size: 797 Bytes

Contents

import React, { useEffect, useRef } from 'react'
import { Body, PhoneNumberInput } from '../..'

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

625 entries across 625 versions & 2 rubygems

Version Path
playbook_ui_docs-13.28.0.pre.alpha.PLAY1338alpha3001 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-13.28.0.pre.alpha.PLAY1338alpha3001 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-13.28.0.pre.alpha.PLAY1343fixTooltiprunwayissue2987 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-13.28.0.pre.alpha.PLAY1343fixTooltiprunwayissue2987 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-13.28.0.pre.alpha.PLAY1343fixTooltiprunwayissue2986 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-13.28.0.pre.alpha.PLAY1343fixTooltiprunwayissue2986 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-13.28.0.pre.alpha.PLAY1343fixTooltiprunwayissue2984 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-13.28.0.pre.alpha.PLAY1343fixTooltiprunwayissue2984 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-13.27.0 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-13.27.0 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-13.26.0.pre.alpha.PBNTR291Dropdownrailsv22840 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-13.26.0.pre.alpha.PBNTR291Dropdownrailsv22840 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-13.26.0.pre.alpha.jasoncypretpatch12820 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-13.26.0.pre.alpha.jasoncypretpatch12820 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-13.26.0.pre.alpha.jasoncypretpatch12816 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-13.26.0.pre.alpha.jasoncypretpatch12816 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-13.25.0.pre.alpha.PBNTR291Dropdownrailsv22812 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-13.25.0.pre.alpha.PBNTR291Dropdownrailsv22812 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui_docs-13.26.0 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx
playbook_ui-13.26.0 app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx