Insert Link Editor
Add and remove hyperlinks in cells

Inserting Links
import { CanvasGrid, SpreadsheetProvider } from "@rowsncolumns/spreadsheet"
import { useSpreadsheet, InsertLinkDialog, InsertLinkEditor } from "@rowsncolumns/spreadsheet-state"
const Spreadsheet = () => {
const {
activeSheetId,
activeCell,
selections,
onInsertLink,
onRequestInsertLink
} = useSpreadsheetState({})
return (
<>
<button onClick={() => onRequestInsertLink()}>Insert link</button>
<InsertLinkDialog>
<InsertLinkEditor
sheetId={activeSheetId}
activeCell={activeCell}
selections={selections}
onInsertLink={onInsertLink}
/>
</InsertLinkDialog>
</>
)
}
const App = () => (
<SpreadsheetProvider>
<Spreadsheet />
</SpreadsheetProvider>
)Removing Links
Use the onRemoveLink callback to remove hyperlinks from cells:
Complete Example with Context Menu
Function Signatures
onInsertLink
onRemoveLink
Use Cases
Adding Links to External Resources
Batch Link Removal
Remove links from multiple cells:
Best Practices
Validate URLs: Ensure URLs are properly formatted before insertion
Provide Feedback: Show visual indicators for cells with links
Handle Errors: Gracefully handle invalid or broken links
Keyboard Shortcuts: Support Ctrl/Cmd+K for inserting links
Context Menu: Add link operations to the cell context menu
Last updated
Was this helpful?