Repository navigation
feat: add multi-line textarea variant for inline cell editing (#1354) - #1397
Conversation
✅ Deploy Preview for react-data-table-component ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The documentation has a critical parse/build issue, and additional API, test, and changelog updates remain.
Review effort: Lite
Findings: 1
Open (3)
What changed in this PR
Adds a multi-line textarea variant for inline cell editing, including keyboard behavior, validation, styling, tests, and documentation.
Changes:
- Adds textarea editor configuration and rendering.
- Supports newline entry, modifier-key/blur commits, and Escape cancellation.
- Adds styling, validation coverage, tests, and documentation.
| File | Summary | Findings |
|---|---|---|
src/types.ts |
Adds the textarea editor type. | Nit (2 votes): Add a CHANGELOG.md entry. |
src/hooks/useCellEdit.ts |
Implements textarea keyboard semantics. | No findings. |
src/DataTable.css |
Styles textarea editors and dense rows. | No findings. |
src/components/CellEditor.tsx |
Renders and wires textarea editors. | No findings. |
src/__tests__/inlineEditing.test.tsx |
Tests textarea behavior and validation. | Moderate (1 vote): Exercise actual newline insertion or limit the assertion to the no-commit behavior. |
apps/docs/src/pages/docs/inline-editing.astro |
Documents textarea usage and styling. | Critical (4 votes): Fix the escaped closing template-literal delimiter causing parse/build failure. Nit (1 vote): Correct the Enter-key commit description. |
apps/docs/src/pages/docs/api.astro |
Documents the textarea CSS class. | Nit (4 votes): Document the textarea variant and rows option in the API reference. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| .rdt_cellEditing { | ||
| box-shadow: inset 0 0 0 3px var(--rdt-color-primary); | ||
| }`} lang="css" /> | ||
| } \`} lang="css" /> |
| ['<code>rdt_cellEditable</code>', 'Cell container', 'Added on every cell that has an editor defined (idle state).'], | ||
| ['<code>rdt_cellEditing</code>', 'Cell container', 'Added while the editor is open. Removes padding and paints the focus ring.'], | ||
| ['<code>rdt_editInput</code>', '<code><input></code>', 'Text editor control inside an editing cell.'], | ||
| ['<code>rdt_editTextarea</code>', '<code><textarea></code>', 'Multi-line textarea editor control inside an editing cell.'], |
| /** Options for inline cell editors. */ | ||
| export type CellEditor<T = unknown> = | ||
| | { type: 'text'; placeholder?: string } | ||
| | { type: 'textarea'; placeholder?: string; rows?: number } |
|
Thanks for this, it's a clean implementation and the keyboard behavior is what we talked about in #1354. Two things before I merge:
Optional, but it'd be nice to add a textarea column (notes or similar) to |
|
Thanks for the review @jbetancur! I've addressed all the feedback:
All 753 tests and typechecks are passing green. |
|
@pardeep1916P played around with this some more. What I originally pictured was more of a popover, since right now the textarea is stuck at the column width and a fixed height. Opening a long note can actually make the cell shorter than the text. That said, this is a good first pass, so let's keep it inline here and I'll we can add the popover as a feature in a future version. A few tweaks to make the inline version feel better:
|
…n open, and update docs demo
|
Updated!
All 755 tests are passing. |


Summary
Closes #1354
This PR adds a
textareavariant to the inline cell editor types for editing multi-line text in place.Proposed API
Key Changes & Design Details
{ type: 'textarea'; placeholder?: string; rows?: number }toCellEditorunion insrc/types.ts.Enter: Inserts a newline without committing (standard<textarea>behavior).Ctrl+EnterorCmd+Enter(Meta+Enter) orblur: Commits the edit and callsonCellEdit.Escape: Cancels the edit and restores original value without firingonCellEdit..rdt_editTextareawithin the cell..rdt_rowDense).validate/onCellEditpipeline, includingaria-invalid, inline error tooltip, and autofocus/refocus handling.apps/docs/src/pages/docs/inline-editing.astroandapps/docs/src/pages/docs/api.astrowith examples and API references.Verification
src/__tests__/inlineEditing.test.tsxcovering:blur,Ctrl+Enter, andCmd/Meta+Enter.onCellEdit.validatefunction rejection and inline tooltip.npm test— 725 of 725 tests passed across 23 test files.npm run typecheck— 0 errors.