module ui // Recursive menu renderer fn menu_html(items []MenuItem, depth int, prefix string) string { mut out := []string{} for i, it in items { id := '${prefix}_${depth}_${i}' if it.children.len > 0 { // expandable group out << '
' out << '' out << '${it.title}' out << '' out << '
' out << '
' out << menu_html(it.children, depth + 1, id) out << '
' out << '
' out << '
' } else { // leaf out << '${it.title}' } } return out.join('\n') }