yewstack / yewstack/yew

Allow use of for loops with `for .. in .. { ... }` syntax in `html!`

Open
#1,451 7 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-yew-macro feature-request
Dominant language
Rust
Stars
32.8k
Forks
1.5k
Avg merge
5h 34m
Merged PRs (30d)
2

Description

Describe the feature you'd like
Allow using for loops like:

html! {
    for val in range {
      <p> { val } </p>
    }
}

Is your feature request related to a problem? Please describe. (Optional)
Current solutions hurt readability when used inside deeply nested html and imo, aren't that concise.

Describe alternatives you've considered (Optional)
There are two alternatives to this (mentioned here). Both of which require you to wrap them in html! or empty tags which doesn't read well.

Additional context (Optional)
This will also bring loop syntax inside html! in-line with the if statement synatx

Questionnaire

  • I'm interested in implementing this myself but don't know where to start
  • I would like to add this feature
  • I don't have time to add this right now, but maybe later

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the html! syntax shown in the issue and read the linked Yew iterators documentation to understand the current alternatives. Define the parser and rendering behavior needed for the displayed for-loop form, then verify that equivalent nested HTML can use it without the existing wrapper patterns.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.