Sha256: 8cdaed93d976c7d8f3c8d918670962a8105b61ed1b04163f7a841e94df64c060

Contents?: true

Size: 1.22 KB

Versions: 673

Compression:

Stored size: 1.22 KB

Contents

import React from 'react'
import { Dropdown, useDropdown, Button } from 'playbook-ui'

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

673 entries across 673 versions & 2 rubygems

Version Path
playbook_ui-14.8.0.pre.rc.2 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-14.7.0.pre.alpha.spacingquickchange4482 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-14.7.0.pre.alpha.spacingquickchange4482 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-14.7.0.pre.alpha.PBNTR637quickpickdefaultdate4478 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-14.7.0.pre.alpha.PBNTR637quickpickdefaultdate4478 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-14.7.0.pre.alpha.PBNTR667railstypeaheadformintegration4454 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-14.7.0.pre.alpha.PBNTR667railstypeaheadformintegration4454 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-14.8.0.pre.rc.1 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-14.8.0.pre.rc.1 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-14.7.0.pre.alpha.dependabotnpmandyarnintltelinput24704448 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-14.7.0.pre.alpha.dependabotnpmandyarnintltelinput24704448 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-14.8.0.pre.rc.0 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-14.8.0.pre.rc.0 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-14.7.0 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-14.6.2.pre.alpha.PLAY1613darkdatetimecolors4432 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-14.6.2.pre.alpha.PLAY1613darkdatetimecolors4432 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-14.7.0.pre.rc.19 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-14.7.0.pre.rc.19 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui_docs-14.7.0.pre.rc.18 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx
playbook_ui-14.7.0.pre.rc.18 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx