9.3.6 • Published 7 months ago

@fluentui/react-tag-picker v9.3.6

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@fluentui/react-tag-picker

React TagPicker components for Fluent UI React

To import React TagPicker components:

import * as React from 'react';
import {
  TagPicker,
  TagPickerList,
  TagPickerInput,
  TagPickerControl,
  TagPickerProps,
  TagPickerOption,
  TagPickerGroup,
} from '@fluentui/react-tag-picker';
import { Tag, Avatar } from '@fluentui/react-components';

const options = [
  'John Doe',
  'Jane Doe',
  'Max Mustermann',
  'Erika Mustermann',
  'Pierre Dupont',
  'Amelie Dupont',
  'Mario Rossi',
  'Maria Rossi',
];

export const Example = () => {
  const [selectedOptions, setSelectedOptions] = React.useState<string[]>([]);
  const onOptionSelect: TagPickerProps['onOptionSelect'] = (e, data) => {
    setSelectedOptions(data.selectedOptions);
  };

  return (
    <div style={{ maxWidth: 400 }}>
      <TagPicker onOptionSelect={onOptionSelect} selectedOptions={selectedOptions}>
        <TagPickerControl>
          <TagPickerGroup>
            {selectedOptions.map(option => (
              <Tag key={option} shape="rounded" media={<Avatar name={option} color="colorful" />} value={option}>
                {option}
              </Tag>
            ))}
          </TagPickerGroup>
          <TagPickerInput />
        </TagPickerControl>
        <TagPickerList>
          {options
            .filter(option => !selectedOptions.includes(option))
            .map(option => (
              <TagPickerOption
                secondaryContent="Microsoft FTE"
                media={<Avatar name={option} color="colorful" />}
                value={option}
                key={option}
              >
                {option}
              </TagPickerOption>
            ))}
        </TagPickerList>
      </TagPicker>
    </div>
  );
};
9.3.6

8 months ago

9.3.5

8 months ago

9.3.4

9 months ago

9.3.3

9 months ago

9.3.2

9 months ago

9.2.5

10 months ago

9.2.4

11 months ago

9.2.3

11 months ago

9.2.2

11 months ago

9.0.4

1 year ago

9.2.1

11 months ago

9.1.1

12 months ago

9.1.0

1 year ago

9.3.1

10 months ago

9.3.0

10 months ago

9.2.0

12 months ago

9.0.3

1 year ago

9.0.2

1 year ago

9.0.1

1 year ago

9.0.0

1 year ago