import * as React from 'react'; import { Dropdown, DropdownMenuItemType, IDropdownOption, IDropdownProps } from '@fluentui/react/lib/Dropdown'; import { Icon } from '@fluentui/react/lib/Icon'; import { Label } from '@fluentui/react/lib/Label'; import { IStackTokens, Stack } from '@fluentui/react/lib/Stack'; import { IconButton } from '@fluentui/react/lib/Button'; const exampleOptions: IDropdownOption[] = [ { key: 'Header', text: 'Options', itemType: DropdownMenuItemType.Header }, { key: 'A', text: 'Option a', data: { icon: 'Memo' } }, { key: 'B', text: 'Option b', data: { icon: 'Print' } }, { key: 'C', text: 'Option c', data: { icon: 'ShoppingCart' } }, { key: 'D', text: 'Option d', data: { icon: 'Train' } }, { key: 'E', text: 'Option e', data: { icon: 'Repair' } }, { key: 'divider_2', text: '-', itemType: DropdownMenuItemType.Divider }, { key: 'Header2', text: 'More options', itemType: DropdownMenuItemType.Header }, { key: 'F', text: 'Option f', data: { icon: 'Running' } }, { key: 'G', text: 'Option g', data: { icon: 'EmojiNeutral' } }, { key: 'H', text: 'Option h', data: { icon: 'ChatInviteFriend' } }, { key: 'I', text: 'Option i', data: { icon: 'SecurityGroup' } }, { key: 'J', text: 'Option j', data: { icon: 'AddGroup' } }, ]; const stackTokens: IStackTokens = { childrenGap: 20 }; const iconStyles = { marginRight: '8px' }; const onRenderLabel = (props: IDropdownProps): JSX.Element => { return ( ); }; const onRenderOption = (option: IDropdownOption): JSX.Element => { return (
{option.data && option.data.icon && (
); }; const onRenderTitle = (options: IDropdownOption[]): JSX.Element => { const option = options[0]; return (
{option.data && option.data.icon && (
); }; const onRenderCaretDown = (): JSX.Element => { return ; }; const onRenderPlaceholder = (props: IDropdownProps): JSX.Element => { return (
); }; const dropdownStyles = { dropdown: { width: 300 } }; export const DropdownCustomExample: React.FunctionComponent = () => ( );