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

[code components] Support custom property editors #3333

Open
Janpot opened this issue Mar 26, 2024 · 2 comments
Open

[code components] Support custom property editors #3333

Janpot opened this issue Mar 26, 2024 · 2 comments
Labels
new feature New feature or request waiting for 👍 Waiting for upvotes

Comments

@Janpot
Copy link
Member

Janpot commented Mar 26, 2024

Summary

It's possible to create custom components, but unlike the built-in components, I can't create custom editors for properties. e.g. the built-in DataGrid has a custom UI for editing its columns.

Toolpad should support code components to supply their own property editors:

import { registerPropertyControl, createComponent } from '@toolpad/studio/browser'

registerPropertyControl('custom-control', function ({ value, setValue, disabled,... }) {
  return <input value={value} onChange={event => setValue(event.target.value)} disabled={disabled} ... />
})

export default createComponent(function () {
  // ...
}, {
  argTypes: {
    foo: {
      control: { type: 'custom-control' }
    }
  }
})

Examples

No response

Motivation

No response

Search keywords: custom property editor

@Janpot Janpot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer new feature New feature or request waiting for 👍 Waiting for upvotes and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 26, 2024
@b4s36t4
Copy link
Contributor

b4s36t4 commented Apr 26, 2024

Would like to work on this, but stuck at understand what needs to be done here.a

What should we be doing here? When a user creates code-component we have to allow the user to specify the args via UI i.e componentpanel right now we do with pre-defined components?

or we should let the users type the code required for the components i.e monaco-editor
or we should make some UI changes to allow creating argsTypes while creating the components itself i.e CreateComponentModal?

@Janpot
Copy link
Member Author

Janpot commented Apr 29, 2024

@b4s36t4 I think we'll need to think through the details a bit more first with the team. I'll likely work on an RFC in the coming weeks as a starting point. in the meantime it'd be helpful if you could share your use-cases for this feature,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request waiting for 👍 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

2 participants