Skip to content

Feature: Structured Icon Support in Table Cells (No HTML Escaping) #1443

@JamesHabben

Description

@JamesHabben

Background

Some modules currently use HTML escaping in the legacy HTML output to render Feather icons in table cells. This works in the HTML renderer but is not something we want to bring into LAVA.

LAVA will not allow raw HTML injection from artifact output. Instead we should provide a structured way for modules to request icons in a cell so the renderer can safely convert that to a Feather icon.

Some important factors to consider in how we approach:

  • avoid HTML escaping/hacks
  • keep React rendering predictable
  • keep parsing minimal during table rendering
  • maintain a stable contract between modules and renderers

Proposed Approach

Introduce a structured icon object that can be returned in table cells. The renderer can then convert this object into a Feather icon in LAVA.

Example cell value:

{
  "icon": {
    "name": "alert-triangle",
    "color": "#f59e0b",
    "size": 16,
    "strokeWidth": 2,
    "position": "after",
    "tooltip": "missing"
  },
  "content": "Missing attachment"
}

Renderer:

  • Name is required, all others are optional
  • Render the Feather icon
  • Render content as text
  • Default position is icon before text

This keeps icon rendering entirely within LAVA instead of embedding presentation logic in module output.

API Helper

Modules should not construct this object directly. Instead we should provide a helper function in the core (ilapfuncs or similar).

Function:

make_icon(icon_name, icon_props=None, content=None, content_type=None)

Example usage:

make_icon(
    "alert-triangle",
    "Missing attachment",
    {"color": "#f59e0b"}
)

Benefits:

  • Centralized schema definition
  • Allows future schema changes without breaking modules
  • Keeps artifact code simpler
  • Ensures consistent structure in output

Optional Enhancement

With this schema structure, we could allow the content to be output with a designated type of its own from one of our other render types.

Example:

{
  "icon": {
    "name": "alert-triangle",
    "color": "#f59e0b",
    "size": 16,
    "strokeWidth": 2,
    "position": "after",
    "tooltip": "missed call"
  },
  "content": "+12345678900",
  "contentType": "phonenumber"
}

Example usage:

make_icon(
    "alert-triangle",
    "+12345678900",
    {"color": "#f59e0b", "tooltip": "Missed Call"},
    "phonenumber"
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions