import * as React from 'react'; import { HoverCard, IExpandingCardProps, DirectionalHint, DetailsList, buildColumns, IColumn, ThemeProvider, KeyCodes, mergeStyleSets, } from '@fluentui/react'; import { createListItems, IExampleItem } from '@fluentui/example-data'; import { useBoolean, useConst } from '@fluentui/react-hooks'; const classNames = mergeStyleSets({ compactCard: { display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%', }, expandedCard: { padding: '16px 24px', }, item: { selectors: { '&:hover': { textDecoration: 'underline', cursor: 'pointer', }, }, }, }); const log = (text: string): (() => void) => { return (): void => { console.log(text); }; }; const items: IExampleItem[] = createListItems(10); const columns: IColumn[] = buildColumns(items).filter(column => column.name === 'location' || column.name === 'key'); const onRenderCompactCard = (item: IExampleItem): JSX.Element => { return (
); }; const onRenderExpandedCard = (item: IExampleItem): JSX.Element => { return (Hover over the key 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.
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{' '}
openHotKey prop and is defined as 'enter' in the following example.