ludic icon indicating copy to clipboard operation
ludic copied to clipboard

Custom element types

Open shocklateboy92 opened this issue 6 months ago • 2 comments

I looked through your documentation, but couldn't find a mechanism to add custom element types.

This would be useful for things like:

  • Web Components
  • Workarounds for bugs in Ludic typings, like #115

Is that supported?

shocklateboy92 avatar Jun 25 '25 20:06 shocklateboy92

The idea is that elements (in ludic) represent raw HTML tags, so you shouldn't be adding new once which do not exist in HTML specification.

You could technically create new ones, but the way it is supposed to work is that you create components, which are basically elements with a few extra features (having custom render() method, supporting themes, etc.).

If there is an element you are missing in ludic, which is part of the HTML specification) it should be added to ludic.

So the way to do it is creating a custom component.

paveldedik avatar Jun 26 '25 07:06 paveldedik

That's fair, so I guess this issue becomes a question: what's the most Ludic idiomatic way of creating a material design button?

The HTML snippet in their example is:

<md-outlined-button>Back</md-outlined-button>

As web components become more prevalent, self-contained client-side libraries that expose themselves as a single

<3d-object-viewer url="some-3d-file.stl"></3d-object-viewer>`

or

<embedded-youtube-player youtube-url="..."></embedded-youtube-player>

will become more common.

Do let me know what you think the most idiomatic way of using these with Luidc is. I'm happy to make a PR to update the docs so people like me can find it easier 😃

shocklateboy92 avatar Jun 28 '25 01:06 shocklateboy92