简体   繁体   English

如何在子菜单中的文本元素的左侧移动SemanticUIReact Icon?

[英]How to move SemanticUIReact Icon left of text element in sub-menu?

The image below demonstrates the current GUI, i simply wish to place the icon to the left of the 'Language' menu instead of the current position (right) 下图演示了当前的GUI,我只是希望将图标放置在“语言”菜单的左侧,而不是当前位置(右侧)

问题

Current Code 当前代码

  </Dropdown.Item>
                <Dropdown text="Language" icon="angle down" pointing="right"
                        options={[
                          { text: 'English', value: 'en', flag: 'gb'},
                          { text: 'Svenska', value: 'se', flag: 'se' },
                          { text: 'Dansk', value: 'de', flag: 'de' },
                          { text: 'Norsk', value: 'no', flag: 'no' },
                        ]}
                    />

Any suggestions on how i could locate the "angle down" icon to the left of the "language" text would be much appreciated. 我对如何找到“语言”文本左侧的“向下倾斜”图标的任何建议将不胜感激。

You could use the trigger prop in stead of text as per the docs and remove the default icon. 您可以根据文档使用trigger道具代替text ,并删除默认图标。



const trigger = (
  <span>
    <Icon name="angle down" /> Language
  </span>
);

const options = [
  { text: "English", value: "en", flag: "gb" },
  { text: "Svenska", value: "se", flag: "se" },
  { text: "Dansk", value: "de", flag: "de" },
  { text: "Norsk", value: "no", flag: "no" }
];

const DropdownTriggerExample = () => (
  <Dropdown pointing="right" trigger={trigger} options={options} icon={null} />
);

Also note that you have a typo for the Danish element ("de" where it should be "dk"). 另请注意,您有一个丹麦元素的错字(“ de”应为“ dk”)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM