import { Meta } from '@storybook/addon-docs'; import Link from '@cloudscape-design/components/link'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; # Migrating from NorthStar legacy - Table Use NorthStar v2 Table component ## Update Import ```diff - import Table from 'aws-northstar/components/Table'; + import Table from '@aws-northstar/ui/components/Table'; ``` ## Update Table Column Definition ```diff - const columnDefinition: Column[] = [ + const columnDefinition: ColumnDefinition[] = [ { id: 'id', width: 200, - Header: 'Id', + header: 'Id', - accessor: 'id', + cell: (data) => data.id, + sortingField: 'id', // If sorting is required on this column }, ... ] ``` ## Update SelectionChangeHandler ```diff + import { NonCancelableEventHandler } from '@cloudscape-design/components/internal/events'; + import { SelectionChangeDetail } from '@aws-northstar/ui/components/Table'; - const handleSelectionChange = useCallback( + const handleSelectionChange: NonCancelableEventHandler> = useCallback( - (selectedItems) => { + ({ detail }) => { + const selectItems = detail.selectedItems; }, [] ); ``` export const Component = () => { return ; };