Skip to content

Render functions #4971

Description

@dasDaniel

Is your feature request related to a problem? Please describe.
I would like to use functions to define content to render. This would allow me to have DOM content configurable within an array.

Describe the solution you'd like
Vue has the h function that can be used to render the this content, something similar would be great, but I'm not sure that it is possible given that svelte does this compile time.

Describe alternatives you've considered
This is the current solution I'm using @html with template literals

        <tr>
          {#each columns as col}
            <td>{@html col.renderValue }</td>
          {/each}
        </tr>

where render value is

      renderValue: v => {
        const className = v.red ? 'red' : 'not-red';
        return `<span class="${className}">${v.icon}</span>`;
      }

How important is this feature to you?
I can do without it

Additional context
repo/code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions