Using Spreadsheet with NextJS
SSR is supported, but Server components, not yet
Add use client
at the top of your file, so this component will be part of client bundle
More info here - https://beta.nextjs.org/docs/rendering/server-and-client-components#convention
Loading Canvas in Node
NextJS throws error while compiling canvas during SSR. If you see these errors,
the solution would be to install canvas
and add it as an external module in nextJS
CSS Specificity when importing stylesheet
NextJS does not respect the order of CSS imports. So there could be style conflicts if you are using tailwindcss in a nextJS project.
The proposed solution is
Install
postcss-import
and add it to yourpostcss.config.js
Import spreadsheet style using the import statement
Credit to https://github.com/radix-ui/themes/issues/109#issuecomment-1747345743 for the fix
(Optional) Using tailwindcss preset to configure spreadsheet styles
If you are still having problems with conflicting css in nextjs, this is another way to solve it.
Install the rowsncolumns tailwind preset
Update tailwindcss content and add the preset
Import spreadsheet css variables
Add a css file spreadsheet.css
and add contents from https://github.com/rowsncolumns/spreadsheet/blob/main/apps/spreadsheet/spreadsheet.css
Import this css file in global.css
Last updated