Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data grid] Export GridEditInputCellRoot related stuff #16285

Open
sneko opened this issue Jan 21, 2025 · 2 comments
Open

[data grid] Export GridEditInputCellRoot related stuff #16285

sneko opened this issue Jan 21, 2025 · 2 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! customization: css Design CSS customizability customization: theme Centered around the theming features feature: Editing Related to the data grid Editing feature new feature New feature or request status: waiting for author Issue with insufficient information

Comments

@sneko
Copy link

sneko commented Jan 21, 2025

Summary

Hi,

I'm using renderCellEdit with an enhanced InputBase. Unfortunately by default it will have fontSize: '1rem', padding: 0 whereas your default GridEditInputCellRoot has fontSize: '0.875rem', padding: '0 16px'.

I know it's always possible to override CSS but it's a bit hacky. I would have expected the properties base you use to be exported so people do not have to hardcode them to mimic the global style on editable cells we don't want to custom

https://github.com/mui/mui-x/blob/4497258e9f9867b4ee29346bca16e83a6322b9c5/packages/x-data-grid/src/components/cell/GridEditInputCell.tsx#L28C7-L39
(same for useUtilityClasses)

Note: I guess this pattern could be applied not only for basic input cells.

Examples

No response

Motivation

No response

Search keywords: renderEditCell style fontSize

@sneko sneko added new feature New feature or request status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 21, 2025
@michelengelen
Copy link
Member

mmh, do you have a suggestion how this could be improved?

I guess one approach would be to export the root component and use it with the as prop where you can pass in your custom InputBase.

Another option would be to introduce something similar to what you briefly mentioned there: useRootComponent or something of that sort.

On the other hand we are currently working on a design agnostic version of the data grid which will probably use composition API for customization.

Thoughts @mui/xgrid ?

@michelengelen michelengelen added component: data grid This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information feature: Editing Related to the data grid Editing feature customization: css Design CSS customizability customization: theme Centered around the theming features and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 21, 2025
@michelengelen michelengelen changed the title Export GridEditInputCellRoot related stuff [data grid] Export GridEditInputCellRoot related stuff Jan 21, 2025
@KenanYusuf
Copy link
Member

KenanYusuf commented Jan 21, 2025

@mui/x I wonder if it would make more sense for us to apply the style overrides in GridRootStyles.ts, like:

[`& .${c['cell--editable']} .${inputBaseClasses.root}`]: {
  ...t.typography.body2,
  padding: '1px 0',
  '& input': {
    padding: '0 16px',
    height: '100%',
  },
},

That way styles get applied to <InputBase /> components used in custom editable cells.

Edit: Although, on second thought, custom styles may be a reason people reach for renderCellEdit in the first place. The style overrides should probably be opt-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! customization: css Design CSS customizability customization: theme Centered around the theming features feature: Editing Related to the data grid Editing feature new feature New feature or request status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

3 participants