How to use @uifabric/example-data - 10 common examples

To help you get started, we’ve selected a few @uifabric/example-data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / utilities / selection / examples / Selection.Basic.Example.tsx View on Github external
constructor(props: {}) {
    super(props);

    this._hasMounted = false;
    // Memoizing this means that given the same parameters, it will return the same array of command objects
    // (performance optimization)
    this._getCommandItems = memoizeFunction(this._getCommandItems);

    this.state = {
      items: createListItems(ITEM_COUNT),
      selection: new Selection({ onSelectionChanged: this._onSelectionChanged }),
      selectionMode: SelectionMode.multiple,
      canSelect: 'all'
    };
    this.state.selection.setItems(this.state.items, false);
  }
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / HoverCard / examples / HoverCard.Target.Example.tsx View on Github external
openHotKey={KeyCodes.enter}
          />
        )}
      
    );
  }

  private _log(text: string): () => void {
    return (): void => {
      console.log(text);
    };
  }
}

export class HoverCardTargetExample extends React.Component<{}, {}> {
  private _items: IExampleItem[] = createListItems(10);
  private _columns: IColumn[] = this._buildColumns();

  public render() {
    return (
      
        <p>
          Hover over the <i>key</i> cell of a row item to see the card or use the keyboard to navigate to it by tabbing to a row and hitting
          the right arrow key.
        </p>
        <p>
          When using the keyboard to navigate, open the card with the hotKey and it will automatically focus the first focusable element in
          the card allowing further navigation inside the card. The hotKey is defined by the hotKey prop and is defined as 'enter' in the
          following example.
        </p>
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / DocumentCard / examples / DocumentCard.Conversation.Example.tsx View on Github external
DocumentCard,
  DocumentCardActivity,
  DocumentCardTitle,
  DocumentCardLogo,
  DocumentCardStatus,
  IDocumentCardLogoProps,
  IDocumentCardActivityPerson,
  IDocumentCardStyles
} from 'office-ui-fabric-react/lib/DocumentCard';
import { mergeStyles } from 'office-ui-fabric-react/lib/Styling';
import { TestImages } from '@uifabric/example-data';

const conversationTileClass = mergeStyles({ height: 182 });

const people: IDocumentCardActivityPerson[] = [
  { name: 'Annie Lindqvist', profileImageSrc: TestImages.personaFemale },
  { name: 'Roko Kolar', profileImageSrc: '', initials: 'RK' },
  { name: 'Aaron Reid', profileImageSrc: TestImages.personaMale },
  { name: 'Christian Bergqvist', profileImageSrc: '', initials: 'CB' },
  { name: 'Greta Lundberg', profileImageSrc: TestImages.personaFemale },
  { name: 'Maor Sharitt', profileImageSrc: TestImages.personaMale },
  { name: 'Velatine Lourvric', profileImageSrc: '', initials: 'VL' },
  { name: 'Kat Larrson', profileImageSrc: TestImages.personaFemale }
];

export const DocumentCardConversationExample: React.StatelessComponent = () => {
  const logoProps: IDocumentCardLogoProps = {
    logoIcon: 'OutlookLogo'
  };

  const cardStyles: IDocumentCardStyles = {
    root: { display: 'inline-block', marginRight: 20, width: 320 }
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Persona / examples / Persona.Basic.Example.tsx View on Github external
export const PersonaBasicExample: React.FunctionComponent = () =&gt; {
  const [renderDetails, updateRenderDetails] = React.useState(true);
  const onChange = (ev: any, checked: boolean | undefined) =&gt; {
    updateRenderDetails(!!checked);
  };

  const examplePersona: IPersonaSharedProps = {
    imageUrl: TestImages.personaFemale,
    imageInitials: 'AL',
    text: 'Annie Lindqvist',
    secondaryText: 'Software Engineer',
    tertiaryText: 'In a meeting',
    optionalText: 'Available at 4:00pm'
  };

  return (
    
      

      <label>Size 8 Persona, with no presence</label>
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Persona / examples / Persona.CustomRender.Example.tsx View on Github external
export const PersonaCustomRenderExample: React.FunctionComponent = () =&gt; {
  const examplePersona: IPersonaSharedProps = {
    imageUrl: TestImages.personaFemale,
    imageInitials: 'AL',
    text: 'Annie Lindqvist',
    secondaryText: 'Software Engineer',
    tertiaryText: 'In a meeting',
    optionalText: 'Available at 4:00pm'
  };

  return (
    
      <div>Custom icon in secondary text</div>
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Persona / examples / Persona.Alternate.Example.tsx View on Github external
export const PersonaAlternateExample: React.FunctionComponent = () =&gt; {
  const examplePersona: IPersonaSharedProps = {
    imageUrl: TestImages.personaFemale,
    imageInitials: 'AR',
    text: 'Annie Reid',
    secondaryText: 'Designer',
    tertiaryText: 'In a meeting',
    optionalText: 'Available at 4:00pm',
    showSecondaryText: true
  };

  return (
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / DocumentCard / examples / DocumentCard.Compact.Example.tsx View on Github external
import {
  DocumentCard,
  DocumentCardActivity,
  DocumentCardDetails,
  DocumentCardPreview,
  DocumentCardTitle,
  IDocumentCardPreviewProps,
  DocumentCardType,
  IDocumentCardActivityPerson
} from 'office-ui-fabric-react/lib/DocumentCard';
import { Stack, IStackTokens } from 'office-ui-fabric-react/lib/Stack';
import { getTheme } from 'office-ui-fabric-react/lib/Styling';
import { TestImages } from '@uifabric/example-data';

const people: IDocumentCardActivityPerson[] = [
  { name: 'Annie Lindqvist', profileImageSrc: TestImages.personaFemale },
  { name: 'Roko Kolar', profileImageSrc: '', initials: 'RK' },
  { name: 'Aaron Reid', profileImageSrc: TestImages.personaMale },
  { name: 'Christian Bergqvist', profileImageSrc: '', initials: 'CB' }
];

export class DocumentCardCompactExample extends React.PureComponent {
  public render(): JSX.Element {
    const previewProps: IDocumentCardPreviewProps = {
      getOverflowDocumentCountText: (overflowCount: number) => `+${overflowCount} more`,
      previewImages: [
        {
          name: 'Revenue stream proposal fiscal year 2016 version02.pptx',
          linkProps: {
            href: 'http://bing.com',
            target: '_blank'
          },
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / DocumentCard / examples / DocumentCard.Conversation.Example.tsx View on Github external
DocumentCardStatus,
  IDocumentCardLogoProps,
  IDocumentCardActivityPerson,
  IDocumentCardStyles
} from 'office-ui-fabric-react/lib/DocumentCard';
import { mergeStyles } from 'office-ui-fabric-react/lib/Styling';
import { TestImages } from '@uifabric/example-data';

const conversationTileClass = mergeStyles({ height: 182 });

const people: IDocumentCardActivityPerson[] = [
  { name: 'Annie Lindqvist', profileImageSrc: TestImages.personaFemale },
  { name: 'Roko Kolar', profileImageSrc: '', initials: 'RK' },
  { name: 'Aaron Reid', profileImageSrc: TestImages.personaMale },
  { name: 'Christian Bergqvist', profileImageSrc: '', initials: 'CB' },
  { name: 'Greta Lundberg', profileImageSrc: TestImages.personaFemale },
  { name: 'Maor Sharitt', profileImageSrc: TestImages.personaMale },
  { name: 'Velatine Lourvric', profileImageSrc: '', initials: 'VL' },
  { name: 'Kat Larrson', profileImageSrc: TestImages.personaFemale }
];

export const DocumentCardConversationExample: React.StatelessComponent = () =&gt; {
  const logoProps: IDocumentCardLogoProps = {
    logoIcon: 'OutlookLogo'
  };

  const cardStyles: IDocumentCardStyles = {
    root: { display: 'inline-block', marginRight: 20, width: 320 }
  };

  return (
    <div></div>