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

Any plan to allow user to create custom plugins ? #465

Open
nathanguigui opened this issue Jul 18, 2023 · 5 comments
Open

Any plan to allow user to create custom plugins ? #465

nathanguigui opened this issue Jul 18, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@nathanguigui
Copy link

Is your feature request related to a problem? Please describe.
I would like to add a plugin for figma preview

Describe the solution you'd like
The best option would be to add the possibility to create custom plugins for ladle

Thanks you for the job you are doing on this project

@nathanguigui nathanguigui added the needs triage needs to be reviewed label Jul 18, 2023
@tajo tajo added enhancement New feature or request and removed needs triage needs to be reviewed labels Jul 18, 2023
@tajo
Copy link
Owner

tajo commented Jul 18, 2023

I am open to it.

There is already quite a lot you can achieve just with https://ladle.dev/docs/providers#ladle-context

I would like to add a plugin for figma preview

Can you document in detail what this integration would look like, including what APIs Ladle should expose/add?

@nathanguigui
Copy link
Author

We can imagine an API like in the storybook to register custom addon in the bottom bar and display custom panel component on open

addons.register(ADDON_ID, (api) => {
  addons.add(PANEL_ID, {
    type: types.PANEL,
    title: 'My Addon',
    render: ({ active, key }) => (
      <AddonPanel active={active} key={key}>
        <div> Storybook addon panel </div>
      </AddonPanel>
    ),
  });
});

For my case (figma addon) I will display inside the panel and iframe linked to my figma in order to simplify the review of the designers.

@hiddenist
Copy link
Contributor

I created a package to inject buttons into the addon bar so that they appear the same as the Ladle built-in addons do. If you would like to use it, here's the repo https://github.com/hiddenist/ladle-inject-custom-addons

image

@tajo
Copy link
Owner

tajo commented Jun 27, 2024

@hiddenist nice, using your lib + https://ladle.dev/docs/providers#ladle-context is basically what the built-in addons are today

we could maybe inline your lib into Ladle directly since it's pretty lightweight integration and opens a lot of possibilities when it comes adding more features into Ladle

@hiddenist
Copy link
Contributor

@tajo Certainly! I would be glad if this could be officially incorporated into Ladle.

I've had pretty good success with this so far, though I had to chase down a strange bug on the built bundle when using MUI for the button icons after upgrading from v2 to v3/v4 🤷🏻

The add-ons that I'm using in my private project could also probably be useful as official add-ons, too. I have a theme color selector, and one that collapses/expands the story sidebar.

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

No branches or pull requests

3 participants