Sha256: b41a82cef91e85a9e2abad1f756b5099c43c41a45a06d2ed79f30fb2712951e7

Contents?: true

Size: 1.38 KB

Versions: 673

Compression:

Stored size: 1.38 KB

Contents

import React from 'react'
import { Dropdown, Icon, Body, FlexItem, Flex } from 'playbook-ui'

const DropdownWithCustomOptions = (props) => {

  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>
    <Dropdown
        options={options}
        {...props}
    >
        {options.map((option) => (
          <Dropdown.Option key={option.id} 
              option={option}
          >
            <Flex
                align="center"
                justify="between"
            >
              <FlexItem>
                <Flex>
                  <Icon icon={option.icon} 
                      paddingRight="xs"
                  />
                  <Body text={option.label} />
                </Flex>
              </FlexItem>
              <FlexItem>
                <Body color="light" 
                    text={option.areaCode} 
                />
              </FlexItem>
            </Flex>
          </Dropdown.Option>
        ))}
    </Dropdown>
  </div>
  )
}

export default  DropdownWithCustomOptions

Version data entries

673 entries across 673 versions & 2 rubygems

Version Path
playbook_ui_docs-14.7.0.pre.alpha.dependabotnpmandyarnfloatinguireact026284532 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui-14.7.0.pre.alpha.dependabotnpmandyarnfloatinguireact026284532 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui-14.8.0 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui_docs-14.7.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4523 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui-14.7.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4523 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui_docs-14.8.0.pre.rc.8 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui-14.8.0.pre.rc.8 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui_docs-14.8.0.pre.rc.7 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui-14.8.0.pre.rc.7 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui_docs-14.8.0.pre.rc.6 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui-14.8.0.pre.rc.6 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui_docs-14.8.0.pre.rc.5 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui-14.8.0.pre.rc.5 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui_docs-14.8.0.pre.rc.4 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui-14.8.0.pre.rc.4 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui_docs-14.8.0.pre.rc.3 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui-14.8.0.pre.rc.3 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui_docs-14.7.0.pre.alpha.PBNTR637quickpickdefaultdate4492 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui-14.7.0.pre.alpha.PBNTR637quickpickdefaultdate4492 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx
playbook_ui_docs-14.8.0.pre.rc.2 app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx