Sha256: e8ae2093a6549d051a9f2f6b5e2041b1cc17223989f55bf70b4c714bde6965f9

Contents?: true

Size: 1.22 KB

Versions: 100

Compression:

Stored size: 1.22 KB

Contents

import React from 'react'
import { Dropdown, useDropdown, Button } from '../../'

const DropdownWithExternalControl = (props) => {
const [isDropDownClosed, setIsDropdownClosed] = useDropdown(true);

  const options = [
    {
      label: "United States",
      value: "United States",
      areaCode: "+1",
      icon: "πŸ‡ΊπŸ‡Έ",
      id: "United-states"
    },
    {
      label: "Canada",
      value: "Canada",
      areaCode: "+1",
      icon: "πŸ‡¨πŸ‡¦",
      id: "canada"
    },
    {
      label: "Pakistan",
      value: "Pakistan",
      areaCode: "+92",
      icon: "πŸ‡΅πŸ‡°",
      id: "pakistan"
    }
  ];  

  return (
  <div>
    <Button
        data={{dropdown:'pb-dropdown-trigger'}}
        marginBottom='sm'
        onClick={() => setIsDropdownClosed(!isDropDownClosed)}
        padding="none"
        tabIndex={0}
        variant="link"
    >
      {isDropDownClosed ? "Open Dropdown" : "Close Dropdown"}
    </Button>

    <Dropdown
        isClosed={isDropDownClosed}
        options={options}
        {...props}
    >
      {options.map((option) => (
        <Dropdown.Option key={option.id} 
            option={option}
        /> 
      ))}
    </Dropdown>
  </div>
  )
}

export default DropdownWithExternalControl

Version data entries

100 entries across 100 versions & 2 rubygems

Version Path
playbook_ui_docs-13.32.0 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-13.32.0 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-13.31.0.pre.alpha.powercentrainplaybookpt23212 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-13.31.0.pre.alpha.powercentrainplaybookpt23212 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-13.31.0.pre.alpha.PLAY10863204 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-13.31.0.pre.alpha.PLAY10863204 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-13.31.0.pre.alpha.PLAY10863202 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-13.31.0.pre.alpha.PLAY10863202 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-13.31.0.pre.alpha.PLAY882formpillprimaryandneutral3201 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-13.31.0.pre.alpha.PLAY882formpillprimaryandneutral3201 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-13.31.0.pre.alpha.play1262iconstyles3172 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-13.31.0.pre.alpha.play1262iconstyles3172 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-13.31.0.pre.alpha.play1262iconstyles3171 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-13.31.0.pre.alpha.play1262iconstyles3171 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-13.31.0 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-13.31.0 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-13.30.0.pre.alpha.play1367contenttagnoninputkits3159 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-13.30.0.pre.alpha.play1367contenttagnoninputkits3159 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-13.30.0.pre.alpha.20240515remotebuildkitconversion3150 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-13.30.0.pre.alpha.20240515remotebuildkitconversion3150 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx