Skip to content

Dropdown - Menu ( options size fit ) #1438

@hanoj-budime

Description

@hanoj-budime

Describe the bug
Dropdowm menu options should fit based on content length.


To Reproduce
Include steps to reproduce the behaviour.

() => {
  const selectOption = (value) => {
    console.log(value);
  };
  const options = [
    {
      value: 1,
      label: "Android",
    },
  ];

  return (
    <DxcInset space="2rem">
      <DxcDropdown
        icon={<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><path d="M64 360c30.9 0 56 25.1 56 56s-25.1 56-56 56s-56-25.1-56-56s25.1-56 56-56zm0-160c30.9 0 56 25.1 56 56s-25.1 56-56 56s-56-25.1-56-56s25.1-56 56-56zM120 96c0 30.9-25.1 56-56 56S8 126.9 8 96S33.1 40 64 40s56 25.1 56 56z"/></svg>}
        caretHidden={true}
        options={options}
        onSelectOption={selectOption}
        size="small"
        padding="xxsmall"
      ></DxcDropdown>
    </DxcInset>
  );
}

Example:

  1. Create a new React App using create-react-app.
  2. Install the @dxc-technology\halstack-react dependencies and run the app.
  3. Click on '...'.
  4. Scroll down to '...'.
  5. See the error.

Expected behaviour
image
https://codesandbox.io/s/dropdown-432qn0?file=/index.html


Screenshots
If applicable, add screenshots to help explain your problem.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestjiraThis task is referenced in a story of Jira

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions